/* Ava chat widget + pop-out page */
.chat-launcher {
  position: fixed; right: 24px; bottom: 24px; z-index: 90;
  display: flex; align-items: center; gap: 10px; padding: 10px 18px 10px 10px;
  border-radius: var(--radius-pill); background: var(--interactive); color: #fff; box-shadow: var(--shadow-2);
  font-weight: 500; transition: transform .15s ease, background-color .15s ease;
}
.chat-launcher:hover { background: var(--interactive-hover); transform: translateY(-1px); }
.chat-launcher .ava-avatar { width: 36px; height: 36px; font-size: 14px; background: #fff; color: var(--interactive); }
.chat-launcher.is-hidden { display: none; }

.chat-panel {
  position: fixed; right: 24px; bottom: 24px; z-index: 95;
  width: 420px; height: min(720px, calc(100vh - 48px));
  display: flex; flex-direction: column;
  background: #fff; border-radius: 16px; box-shadow: var(--shadow-2); border: 1px solid var(--surface-3);
  overflow: hidden;
  transform-origin: bottom right; transition: opacity .18s ease, transform .18s ease;
}
.chat-panel.is-closed { opacity: 0; transform: scale(.96) translateY(8px); pointer-events: none; }
.chat-panel.is-page { position: relative; width: 100%; height: 100%; max-width: 860px; margin: 0 auto; border-radius: 0; box-shadow: none; border: 0; }
@media (max-width: 520px) { .chat-panel:not(.is-page) { right: 0; bottom: 0; width: 100%; height: 100%; border-radius: 0; } }

.chat-header { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--surface-3); background: #fff; }
.chat-header .ava-avatar { width: 40px; height: 40px; font-size: 15px; }
.chat-header .title { flex: 1; min-width: 0; }
.chat-header .title strong { display: block; font-size: 15px; line-height: 20px; }
.chat-header .title span { display: block; font-size: 12px; color: var(--green); font-weight: 500; }
.chat-header .tools { display: flex; gap: 4px; }
.chat-tool { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; color: var(--text-secondary); }
.chat-tool:hover { background: var(--surface-2); color: var(--text); }
.chat-tool svg { width: 20px; height: 20px; }

/* Persona bar: overflow visible so the tooltip (opening DOWNWARD) is never clipped */
.persona-bar { position: relative; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: 5px; padding: 8px 10px; border-bottom: 1px solid var(--surface-3); background: var(--surface-2); overflow: visible; }
.persona-bar .label { font-size: 11px; font-weight: 500; color: var(--text-secondary); margin-right: 4px; text-transform: uppercase; letter-spacing: .3px; }
.persona { position: relative; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: 10px; font-weight: 700; color: #fff; border: 2px solid transparent; transition: transform .12s ease; }
.persona:hover { transform: translateY(-1px); }
.persona.is-active { border-color: var(--text); box-shadow: 0 0 0 2px #fff inset; }
.persona .tip {
  position: absolute; top: calc(100% + 8px); left: 0; z-index: 30;
  width: 264px; padding: 12px 14px; border-radius: var(--radius-lg); background: #fff; color: var(--text);
  box-shadow: var(--shadow-2); border: 1px solid var(--surface-3); text-align: left; font-weight: 350; font-size: 12px; line-height: 17px;
  opacity: 0; visibility: hidden; transform: translateY(-4px); transition: opacity .12s ease, transform .12s ease;
}
.persona:hover .tip, .persona:focus-visible .tip { opacity: 1; visibility: visible; transform: translateY(0); }
.persona:nth-last-child(-n+3) .tip { left: auto; right: 0; }
.persona .tip strong { display: block; font-size: 13px; }
.persona .tip .tip-sub { color: var(--text-secondary); margin-bottom: 8px; }
.persona .tip dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 2px 8px; }
.persona .tip dt { color: var(--text-secondary); white-space: nowrap; }
.persona .tip dd { margin: 0; }
.persona .tip .tip-hist { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--surface-3); }
.persona .tip .tip-hist div { display: flex; gap: 6px; align-items: flex-start; margin-top: 3px; }
.persona .tip .dot { flex: none; width: 8px; height: 8px; border-radius: 50%; margin-top: 4px; }
.persona .tip .dot.love { background: var(--green); }
.persona .tip .dot.meh { background: var(--red); }
.persona-guest { width: auto; padding: 0 9px; border-radius: var(--radius-pill); background: #fff; color: var(--text); border: 1px solid var(--border); font-size: 11px; }
.persona-guest.is-active { border-color: var(--text); box-shadow: none; }

.chat-body { flex: 1; overflow-y: auto; padding: 16px 14px; display: flex; flex-direction: column; gap: 12px; background: #fff; scroll-behavior: smooth; }
.msg { display: flex; flex-direction: column; gap: 8px; max-width: 92%; }
.msg.user { align-self: flex-end; align-items: flex-end; }
.msg.assistant { align-self: flex-start; }
.bubble { padding: 10px 14px; border-radius: 14px; font-size: 14px; line-height: 21px; word-wrap: break-word; }
.msg.user .bubble { background: var(--interactive); color: #fff; border-bottom-right-radius: 4px; }
.msg.assistant .bubble { background: var(--surface-2); color: var(--text); border-bottom-left-radius: 4px; }
.bubble a { color: var(--interactive); text-decoration: underline; text-underline-offset: 2px; }
.msg.user .bubble a { color: #fff; }
.bubble.is-error { background: var(--red-tint); color: var(--red); }
.bubble.is-system { background: var(--yellow-tint); color: var(--yellow); font-size: 13px; }

.typing { display: inline-flex; gap: 4px; align-items: center; padding: 12px 14px; background: var(--surface-2); border-radius: 14px; border-bottom-left-radius: 4px; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--text-tertiary); animation: blink 1.2s infinite ease-in-out; }
.typing i:nth-child(2) { animation-delay: .2s; }
.typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

/* Inline product card: image left, details right */
.pcard { display: grid; grid-template-columns: 88px 1fr; gap: 12px; width: 100%; max-width: 360px; padding: 10px; border: 1px solid var(--surface-3); border-radius: 12px; background: #fff; text-align: left; box-shadow: 0 1px 3px rgba(0, 0, 0, .04); transition: box-shadow .15s ease, border-color .15s ease; }
.pcard:hover { box-shadow: var(--shadow-1); border-color: var(--border); }
.pcard .pimg { background: #fff; border: 1px solid var(--surface-3); border-radius: 8px; aspect-ratio: 1; display: grid; place-items: center; padding: 6px; }
.pcard .pimg img { width: 92%; height: 92%; object-fit: contain; }
.pcard .pbody { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.pcard .pname { font-weight: 700; font-size: 13px; line-height: 18px; }
.pcard .psub { font-size: 12px; color: var(--text-secondary); line-height: 16px; }
.pcard .pprice { display: flex; gap: 8px; align-items: baseline; margin-top: auto; }
.pcard .pprice strong { font-size: 15px; }
.pcard .pprice strong.is-sale { color: var(--orange); }
.pcard .pprice s { font-size: 12px; color: var(--text-secondary); }
.pcard .pactions { display: flex; gap: 6px; margin-top: 6px; }
.pcard .pactions button, .pcard .pactions a { font-size: 12px; font-weight: 500; padding: 5px 10px; border-radius: var(--radius-pill); border: 1px solid var(--border); }
.pcard .pactions .add { background: var(--interactive); color: #fff; border-color: var(--interactive); }
.pcard .pactions .add:hover { background: var(--interactive-hover); }
.pcard .pactions a:hover { background: var(--surface-2); }
.pcaption { font-size: 12.5px; line-height: 18px; color: var(--text-secondary); padding: 0 4px; max-width: 360px; }

.quick-replies { display: flex; flex-wrap: wrap; gap: 8px; }
.qr { padding: 7px 14px; border-radius: var(--radius-pill); border: 1px solid var(--interactive); color: var(--interactive); font-size: 13px; font-weight: 500; background: #fff; transition: background-color .12s ease; }
.qr:hover { background: var(--interactive-tint); }
.qr:disabled { opacity: .5; cursor: default; }

/* Guided Lumea wizard */
.lumea-wizard { width: 100%; max-width: 380px; padding: 14px; border: 1px solid var(--surface-3); border-radius: 12px; background: #fff; display: grid; gap: 12px; }
.lw-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.lw-kicker { display: block; margin-bottom: 2px; color: var(--text-secondary); font-size: 11px; font-weight: 700; letter-spacing: .35px; text-transform: uppercase; }
.lw-step { display: block; font-size: 15px; line-height: 20px; }
.lw-count { flex: none; padding: 3px 8px; border-radius: var(--radius-pill); background: var(--surface-2); color: var(--text-secondary); font-size: 11px; font-weight: 500; }
.lw-progress { height: 4px; overflow: hidden; border-radius: var(--radius-pill); background: var(--surface-3); }
.lw-progress span { display: block; height: 100%; border-radius: inherit; background: var(--interactive); transition: width .2s ease; }
.lw-question { margin: 2px 0 0; font-size: 16px; line-height: 22px; }
.lw-hint, .lw-suggestion { margin: -6px 0 0; color: var(--text-secondary); font-size: 12.5px; line-height: 18px; }
.lw-suggestion { margin-top: -4px; padding: 8px 10px; border-radius: 8px; background: var(--interactive-tint); color: var(--interactive); }
.lw-help { margin-top: -2px; border: 1px solid var(--surface-3); border-radius: 9px; background: var(--surface-2); }
.lw-help summary { padding: 8px 10px; color: var(--interactive); cursor: pointer; font-size: 12.5px; font-weight: 500; }
.lw-help summary:focus-visible { outline: 2px solid var(--interactive); outline-offset: 2px; border-radius: 8px; }
.lw-help-body { display: grid; gap: 8px; padding: 0 10px 10px; }
.lw-help-body p { margin: 0; color: var(--text-secondary); font-size: 12px; line-height: 17px; }
.lw-help .scan-link { width: max-content; max-width: 100%; padding: 7px 10px; }
.lw-actions { display: flex; align-items: center; gap: 8px; padding-top: 2px; }
.lw-next { min-width: 112px; margin-left: auto; }
.lw-back { border-color: var(--border); color: var(--text-secondary); }

/* Option cards (Lumea swatches, treatment areas, safety check) */
.opt-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; width: 100%; }
.opt-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.opt { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-width: 0; padding: 10px; border: 1px solid var(--border); border-radius: 10px; background: #fff; text-align: left; font-size: 12px; line-height: 16px; transition: border-color .12s ease, box-shadow .12s ease; }
.opt:hover { border-color: var(--interactive); box-shadow: 0 0 0 2px var(--interactive-tint-2); }
.opt:focus-visible { outline: 2px solid var(--interactive); outline-offset: 2px; }
.opt.is-selected { border: 2px solid var(--interactive); padding: 9px; background: var(--interactive-tint); }
.opt .swatch { width: 100%; height: 34px; border-radius: 6px; border: 1px solid rgba(0, 0, 0, .08); }
.opt strong { font-size: 12.5px; }
.opt span { color: var(--text-secondary); }
.opt-done { align-self: flex-start; }

/* Compact result with expandable supporting detail */
.verdict { width: 100%; max-width: 380px; overflow: hidden; border: 1px solid var(--surface-3); border-radius: 12px; background: #fff; font-size: 13px; line-height: 19px; }
.verdict-top { display: grid; gap: 8px; padding: 15px 14px 12px; }
.verdict-title { display: flex; align-items: center; gap: 10px; }
.verdict .v-kicker { display: block; color: var(--text-secondary); font-size: 10.5px; font-weight: 700; letter-spacing: .35px; text-transform: uppercase; }
.verdict .vhead { margin: 1px 0 0; font-size: 15px; line-height: 20px; }
.verdict .vhead:focus-visible { outline: 2px solid var(--interactive); outline-offset: 3px; border-radius: 2px; }
.verdict .vicon { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; }
.verdict.ok .vicon { background: var(--green-tint); color: var(--green); }
.verdict.care .vicon { background: var(--yellow-tint); color: var(--yellow); }
.verdict.no .vicon { background: var(--red-tint); color: var(--red); }
.verdict .vicon svg { width: 16px; height: 16px; }
.verdict .vsummary { margin: 0; color: var(--text-secondary); font-size: 12.5px; line-height: 18px; }
.verdict .vnotice { display: grid; gap: 2px; margin: 0 14px 12px; padding: 9px 10px; border-radius: 8px; background: var(--surface-2); color: var(--text-secondary); font-size: 12px; line-height: 17px; }
.verdict .vnotice strong { color: var(--text); font-size: 12px; }
.verdict.care .vnotice { background: var(--yellow-tint); }
.verdict.no .vnotice { background: var(--red-tint); color: var(--red); }
.verdict.no .vnotice strong { color: var(--red); }
.verdict-details { border-top: 1px solid var(--surface-3); }
.verdict-details summary { position: relative; display: grid; grid-template-columns: 1fr auto; column-gap: 12px; padding: 10px 36px 10px 14px; cursor: pointer; list-style: none; }
.verdict-details summary::-webkit-details-marker { display: none; }
.verdict-details summary::after { position: absolute; top: 50%; right: 14px; content: '+'; color: var(--interactive); font-size: 20px; font-weight: 350; line-height: 1; transform: translateY(-50%); }
.verdict-details[open] summary::after { content: '−'; }
.verdict-details summary:hover { background: var(--surface-2); }
.verdict-details summary:focus-visible { outline: 2px solid var(--interactive); outline-offset: -2px; }
.verdict-details summary > span { color: var(--text); font-weight: 600; }
.verdict-details summary > small { display: block; overflow: hidden; color: var(--text-secondary); font-size: 11.5px; font-weight: 400; text-overflow: ellipsis; white-space: nowrap; }
.verdict-details-body { display: grid; gap: 7px; padding: 0 14px 12px; }
.verdict .vrow { display: grid; grid-template-columns: 94px 1fr; gap: 8px; color: var(--text-secondary); }
.verdict .vrow b { color: var(--text); font-weight: 500; }
.verdict .vrow .swatch { display: inline-block; width: 14px; height: 14px; margin-right: 6px; border: 1px solid rgba(0, 0, 0, .08); border-radius: 3px; vertical-align: -2px; }
.verdict .vdisclaimer { margin: 0; color: var(--text-secondary); font-size: 12px; line-height: 17px; }
.verdict .vfoot { margin: 0; padding: 8px 14px; border-top: 1px solid var(--surface-3); background: var(--surface-2); color: var(--text-tertiary); font-size: 10.5px; }

/* Booking */
.booking { width: 100%; max-width: 380px; display: grid; gap: 10px; }
.store-card { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 12px; border: 1px solid var(--border); border-radius: 10px; background: #fff; text-align: left; font-size: 12.5px; line-height: 17px; }
.store-card:hover { border-color: var(--interactive); }
.store-card.is-selected { border: 2px solid var(--interactive); padding: 11px; background: var(--interactive-tint); }
.store-card strong { display: block; font-size: 13px; }
.store-card .addr { color: var(--text-secondary); }
.store-card .dist { font-weight: 500; color: var(--interactive); white-space: nowrap; }
.day-tabs { display: flex; gap: 6px; }
.day-tab { flex: 1; padding: 8px; border-radius: 8px; border: 1px solid var(--border); font-size: 12.5px; font-weight: 500; background: #fff; }
.day-tab.is-active { background: var(--interactive); color: #fff; border-color: var(--interactive); }
.slots { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.slot { padding: 8px 4px; border-radius: 8px; border: 1px solid var(--border); font-size: 13px; font-weight: 500; background: #fff; }
.slot:hover { border-color: var(--interactive); color: var(--interactive); }
.slot.is-selected { background: var(--interactive); color: #fff; border-color: var(--interactive); }
.confirm-card { width: 100%; max-width: 380px; border-radius: 12px; overflow: hidden; border: 1px solid var(--surface-3); background: #fff; font-size: 13px; line-height: 19px; }
.confirm-card .chead { background: var(--green); color: #fff; padding: 10px 14px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.confirm-card .chead svg { width: 18px; height: 18px; }
.confirm-card .cbody { padding: 12px 14px; display: grid; gap: 4px; }
.confirm-card .cbody .id { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 700; color: var(--interactive); font-size: 15px; }
.confirm-card .cbody .row { display: flex; gap: 8px; }
.confirm-card .cbody .row b { min-width: 72px; font-weight: 500; color: var(--text-secondary); }

/* Photo scan: user bubble with image */
.msg.user .bubble.has-image { display: grid; gap: 8px; padding: 6px; }
.msg.user .bubble.has-image .uimg { display: block; width: 160px; max-width: 100%; height: auto; border-radius: 10px; }
.msg.user .bubble.has-image span { padding: 0 8px 4px; font-size: 13px; }

/* Photo scan: Ava's estimate card */
.photo-card { width: 100%; max-width: 380px; border-radius: 12px; padding: 14px; border: 1px solid var(--surface-3); background: #fff; display: grid; gap: 10px; font-size: 13px; line-height: 19px; }
.photo-card.is-invalid { border-color: var(--yellow); background: var(--yellow-tint); }
.photo-card .phead { display: flex; gap: 12px; align-items: center; }
.photo-card .phead strong { display: block; font-size: 14px; }
.photo-card .phead span { display: block; font-size: 12px; color: var(--text-secondary); }
.photo-card .pthumb { flex: none; width: 56px; height: 56px; object-fit: cover; border-radius: 10px; border: 1px solid var(--surface-3); }
.photo-card .psummary { margin: 0; }
.photo-card .prow { display: grid; grid-template-columns: 82px 1fr auto; gap: 8px; align-items: start; padding-top: 8px; border-top: 1px solid var(--surface-3); }
.photo-card .prow b { font-weight: 500; color: var(--text); }
.photo-card .prow > span { display: block; min-width: 0; }
.photo-card .prow small { display: block; font-size: 12px; color: var(--text-secondary); line-height: 16px; }
.photo-card .prow .swatch { display: inline-block; width: 14px; height: 14px; border-radius: 3px; vertical-align: -2px; margin-right: 6px; border: 1px solid rgba(0, 0, 0, .08); }
.photo-card .conf { font-style: normal; font-size: 11px; font-weight: 500; padding: 2px 8px; border-radius: var(--radius-pill); white-space: nowrap; }
.photo-card .conf-high { background: var(--green-tint); color: var(--green); }
.photo-card .conf-medium { background: var(--interactive-tint); color: var(--interactive); }
.photo-card .conf-low { background: var(--yellow-tint); color: var(--yellow); }
.photo-card .pnotes { margin: 0; font-size: 12.5px; color: var(--text-secondary); }
.photo-card .phint { margin: 0; font-size: 12px; color: var(--text-tertiary); border-top: 1px solid var(--surface-3); padding-top: 8px; }
.photo-card .pactions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.photo-card .pstatus { font-size: 12px; color: var(--text-secondary); font-weight: 500; }
.qr.qr-quiet { border-color: var(--border); color: var(--text-secondary); }

/* Suggested option (from photo) + scan shortcut in the Lumea picker */
.opt { position: relative; }
.opt.is-suggested:not(.is-selected) { border-style: dashed; border-color: var(--interactive); }
.opt .tag { position: absolute; top: 6px; right: 6px; font-style: normal; font-size: 10px; font-weight: 700; letter-spacing: .2px; text-transform: uppercase; padding: 2px 6px; border-radius: var(--radius-pill); background: var(--interactive); color: #fff; }
.scan-link { display: inline-flex; align-items: center; gap: 8px; align-self: flex-start; padding: 8px 12px; border-radius: 10px; border: 1px dashed var(--interactive); background: var(--interactive-tint); color: var(--interactive); font-size: 12.5px; font-weight: 500; text-align: left; line-height: 16px; max-width: 380px; }
.scan-link:hover { background: var(--interactive-tint-2); }
.scan-link svg { width: 18px; height: 18px; flex: none; }

/* Scan sheet (camera / upload), overlays the chat body inside the panel */
.scan-sheet { position: absolute; inset: 0; z-index: 40; display: flex; flex-direction: column; gap: 10px; padding: 14px; background: #fff; overflow-y: auto; }
.scan-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.scan-head strong { display: block; font-size: 15px; }
.scan-head span { display: block; font-size: 12px; color: var(--text-secondary); }
.scan-tip { margin: 0; font-size: 13px; line-height: 19px; color: var(--text-secondary); }
.scan-stage { position: relative; width: 100%; aspect-ratio: 4 / 3; max-height: 46vh; border-radius: 12px; overflow: hidden; background: var(--text); display: grid; place-items: center; }
.scan-stage video, .scan-stage .scan-preview { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: none; }
.scan-stage .scan-empty { display: none; flex-direction: column; align-items: center; gap: 8px; color: #fff; font-size: 13px; opacity: .85; }
.scan-stage .scan-empty svg { width: 40px; height: 40px; }
.scan-stage .scan-guide { position: absolute; inset: 14% 12%; border: 2px dashed rgba(255, 255, 255, .7); border-radius: 12px; display: none; pointer-events: none; }
.scan-sheet[data-mode="starting"] .scan-empty { display: flex; }
.scan-sheet[data-mode="live"] video, .scan-sheet[data-mode="live"] .scan-guide { display: block; }
.scan-sheet[data-mode="upload"] .scan-empty { display: flex; }
.scan-sheet[data-mode="preview"] .scan-preview { display: block; }
.scan-note { margin: 0; font-size: 12.5px; color: var(--yellow); background: var(--yellow-tint); padding: 8px 10px; border-radius: 8px; }
.scan-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.scan-actions .btn { display: inline-flex; align-items: center; gap: 6px; }
.scan-actions .btn svg { width: 18px; height: 18px; }
.scan-actions .scan-shutter, .scan-actions .scan-use, .scan-actions .scan-retake { display: none; }
.scan-sheet[data-mode="live"] .scan-shutter { display: inline-flex; }
.scan-sheet[data-mode="preview"] .scan-use, .scan-sheet[data-mode="preview"] .scan-retake { display: inline-flex; }
.scan-sheet[data-mode="preview"] .scan-upload { display: none; }
.scan-privacy { margin: auto 0 0; font-size: 11px; color: var(--text-tertiary); text-align: center; }
.chat-panel.is-page .scan-sheet { padding-left: max(14px, calc((100% - 560px) / 2)); padding-right: max(14px, calc((100% - 560px) / 2)); }

/* Composer */
.chat-footer { border-top: 1px solid var(--surface-3); padding: 10px 12px 12px; background: #fff; }
.composer { display: flex; align-items: flex-end; gap: 8px; border: 1px solid var(--border); border-radius: 22px; padding: 6px 6px 6px 14px; }
.composer:focus-within { border-color: var(--interactive); box-shadow: 0 0 0 2px var(--interactive-tint-2); }
.composer textarea { flex: 1; border: 0; outline: none; resize: none; max-height: 120px; padding: 8px 0; font-size: 14px; line-height: 20px; background: transparent; }
.composer .send { width: 36px; height: 36px; border-radius: 50%; background: var(--interactive); color: #fff; display: grid; place-items: center; flex: none; }
.composer .send:hover { background: var(--interactive-hover); }
.composer .send:disabled { background: var(--border); }
.composer .send svg { width: 18px; height: 18px; }
.chat-footer .hint { font-size: 11px; color: var(--text-tertiary); text-align: center; margin-top: 6px; }

/* Pop-out page frame */
.chat-page { height: 100vh; display: flex; flex-direction: column; background: var(--surface-2); }
.chat-page .chat-panel.is-page { flex: 1; min-height: 0; border-left: 1px solid var(--surface-3); border-right: 1px solid var(--surface-3); }
.chat-page .chat-body { padding: 24px; }
.chat-page .msg { max-width: 78%; }

/* Conversation continuity and progressive states */
.chat-panel { height: min(720px, calc(100dvh - 48px)); }
.chat-new-message { position: absolute; right: 16px; bottom: 92px; z-index: 8; min-height: 36px; padding: 7px 13px; border: 1px solid var(--interactive); border-radius: var(--radius-pill); background: #fff; color: var(--interactive); box-shadow: var(--shadow-1); font-size: 12.5px; font-weight: 500; }
.chat-new-message:hover { background: var(--interactive-tint); }
.typing { gap: 9px; }
.typing-dots { display: inline-flex; align-items: center; gap: 4px; }
.typing-label { color: var(--text-secondary); font-size: 12px; }
.flow-status, .flow-error { max-width: 380px; padding: 9px 12px; border-radius: 9px; background: var(--surface-2); color: var(--text-secondary); font-size: 12.5px; line-height: 18px; }
.flow-error { background: var(--red-tint); color: var(--red); }
.error-actions { display: flex; gap: 8px; }
.product-retry { align-self: flex-start; padding: 7px 12px; border: 1px solid var(--border); border-radius: var(--radius-pill); color: var(--interactive); background: #fff; font-size: 12.5px; font-weight: 500; }
.product-retry:hover { background: var(--interactive-tint); border-color: var(--interactive); }
.pcard-loading { min-height: 118px; }
.pcard-loading .skeleton { border: 0; background: linear-gradient(90deg, var(--surface-2) 20%, var(--surface-3) 45%, var(--surface-2) 70%); background-size: 220% 100%; animation: chat-shimmer 1.4s ease-in-out infinite; }
.pcard-loading .line { width: 72%; height: 11px; margin-top: 6px; border-radius: 6px; }
.pcard-loading .line.wide { width: 94%; height: 14px; }
.pcard-loading .line.short { width: 46%; margin-top: auto; }
@keyframes chat-shimmer { to { background-position: -220% 0; } }

.chat-meta { position: relative; display: flex; justify-content: center; min-height: 17px; margin-top: 6px; }
.chat-footer .chat-meta .hint { margin: 0; }
.char-count { position: absolute; right: 2px; color: var(--text-tertiary); font-size: 10px; }
.composer button:disabled { cursor: default; }

.chat-confirm { position: absolute; inset: 0; z-index: 60; display: grid; place-items: center; padding: 20px; background: rgba(21, 25, 30, .34); backdrop-filter: blur(2px); }
.chat-confirm-card { width: min(100%, 340px); padding: 20px; border-radius: 12px; background: #fff; box-shadow: var(--shadow-2); }
.chat-confirm-card strong { display: block; font-size: 17px; line-height: 22px; }
.chat-confirm-card p { margin: 8px 0 18px; color: var(--text-secondary); font-size: 14px; line-height: 20px; }
.chat-confirm-actions { display: flex; justify-content: flex-end; gap: 8px; }

.chat-page { height: 100dvh; }
@media (max-width: 520px) {
  .chat-panel:not(.is-page) { height: 100dvh; }
  .chat-header { padding-top: max(12px, env(safe-area-inset-top)); }
  .chat-footer { padding-bottom: max(12px, env(safe-area-inset-bottom)); }
  .chat-body { padding: 14px 12px; }
  .msg { max-width: 96%; }
  .pcard, .photo-card, .verdict, .booking, .confirm-card { max-width: 100%; }
  .pcard .pactions { flex-wrap: wrap; }
  .chat-new-message { bottom: calc(92px + env(safe-area-inset-bottom)); }
}
@media (max-width: 360px) {
  .slots { grid-template-columns: repeat(2, 1fr); }
  .opt-grid { grid-template-columns: repeat(2, 1fr); }
  .photo-card .prow { grid-template-columns: 74px 1fr; }
  .photo-card .conf { grid-column: 2; justify-self: start; }
  .chat-page .chat-body { padding: 14px 12px; }
  .chat-page .msg { max-width: 100%; }
}
@media (pointer: coarse) {
  .persona { min-width: 40px; min-height: 40px; }
  .persona-guest { min-height: 40px; }
  .chat-tool, .composer .send { width: 40px; height: 40px; }
  .qr, .pcard .pactions button, .pcard .pactions a { min-height: 40px; display: inline-flex; align-items: center; }
}
@media (prefers-reduced-motion: reduce) {
  .chat-panel, .chat-launcher, .persona, .pcard, .qr, .opt { transition: none; }
  .chat-body { scroll-behavior: auto; }
  .typing i, .pcard-loading .skeleton { animation: none; }
}

/* Explicit opt-in action for the Lumea suitability flow */
.qr.lumea-start { background: var(--interactive); color: #fff; }
.qr.lumea-start:hover { background: var(--interactive-hover); }
