/* Conversation interface. Uses the existing site typography and palette. */
.chat-shell { padding: 0; min-width: 480px; width: min(82%, 600px); border: 4px solid var(--paper); border-radius: 30px; overflow: clip; box-shadow: 0 0 0 1px #ffffff38, 0 24px 64px #00000030; }
.chat-header { display: flex; align-items: center; gap: .75rem; padding: 1rem 1.2rem; border-bottom: 1px solid var(--line); background: var(--paper); }
.chat-avatar { width: 44px; height: 44px; flex: 0 0 44px; overflow: hidden; border-radius: 50%; background: var(--accent-soft); }
.chat-avatar img { width: 100%; height: 100%; object-fit: cover; }
.chat-identity { flex: 1; min-width: 0; }
.chat-identity h2 { margin: 0; font-size: 1.08rem; line-height: 1.3; font-weight: 700; }
.chat-identity p { margin: .1rem 0 0; color: var(--muted); font-size: .78rem; line-height: 1.35; }
.chat-test-badge { align-self: start; margin-top: .1rem; padding: .18rem .48rem; border-radius: 20px; color: var(--accent-text-on-light); background: color-mix(in srgb, var(--accent-soft) 60%, white); font-size: .65rem; white-space: nowrap; }
.chat-back { flex: 0 0 40px; min-height: 44px; padding: 0; color: var(--navy); background: var(--paper-deep); border-radius: 50%; font-size: 1.5rem; }
.chat-shell .contact-panel { padding: 1.2rem 1.2rem .15rem; }
.chat-shell #guide-panel { padding: 1.3rem; }
.chat-price-title { margin-bottom: .6rem; font-size: 1.3rem; }
.chat-log-wrap { position: relative; }
.chat-conversation { display: flex; flex-direction: column; gap: .6rem; min-height: 80px; max-height: 290px; overflow-y: auto; overflow-anchor: none; overscroll-behavior: contain; scrollbar-width: thin; padding: .5rem .35rem .6rem .25rem; }
.chat-latest { position: absolute; right: .9rem; bottom: .65rem; min-height: 44px; padding: .5rem .8rem; display: flex; gap: .6rem; align-items: center; border: 1px solid var(--line); border-radius: 24px; background: var(--paper); color: var(--navy); box-shadow: 0 3px 12px #00000018; font-size: .78rem; }
.chat-latest:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.chat-message.chat-cue { animation: chat-answer-cue 1.2s ease-out; }
.chat-compose.chat-cue { animation: chat-compose-cue 2s ease-out; }
@keyframes chat-answer-cue { from { box-shadow: inset 3px 0 var(--accent); background: var(--accent-soft); } to { box-shadow: inset 0 0 transparent; background: var(--paper-deep); } }
@keyframes chat-compose-cue { 0%, 35% { box-shadow: 0 0 0 4px var(--accent-soft), 0 0 18px #b78f4d30; border-color: var(--accent); } 100% { box-shadow: 0 0 0 3px #e2e6ee; border-color: var(--navy); } }
.chat-shell[data-long-answer="true"] .chat-conversation { max-height: min(65dvh, 580px); }
.chat-turn { display: flex; align-items: flex-end; gap: .45rem; flex-shrink: 0; min-width: 0; }
.chat-turn-you { justify-content: flex-end; }
.chat-message-avatar { flex: 0 0 28px; width: 28px; height: 28px; border-radius: 50%; object-fit: cover; align-self: flex-start; position: sticky; top: .2rem; }
.chat-turn-svein .chat-message { max-width: calc(100% - 36px); }
.chat-shell[data-stage="contact"] .chat-conversation { max-height: 170px; }
.chat-shell[data-stage="contact"] .chat-next { display: none; }
.chat-message { width: fit-content; max-width: 92%; border-radius: 16px 16px 16px 4px; padding: .9rem 1rem; font-size: 1rem; line-height: 1.65; overflow-wrap: anywhere; flex-shrink: 0; }
.chat-message p { margin: 0; white-space: pre-wrap; }
.chat-message p + p { margin-top: 1rem; }
.chat-message-svein { align-self: flex-start; background: var(--paper-deep); color: var(--ink); }
.chat-message-you { align-self: flex-end; background: var(--navy); color: white; border-radius: 16px 16px 4px 16px; }
.chat-message-label { display: block; margin-bottom: .3rem; opacity: .75; font-size: .68rem; font-weight: 600; letter-spacing: .01em; }
.chat-suggestions { display: flex; flex-direction: column; align-items: flex-end; gap: .5rem; margin: .7rem 0 0; }
.chat-suggestions button { min-height: 44px; max-width: 96%; padding: .6rem .9rem; border: 1px solid #bac1cd; border-radius: 18px; color: var(--navy); background: var(--paper); font-size: .88rem; line-height: 1.4; text-align: left; }
.chat-suggestions button:hover { border-color: var(--navy); background: var(--paper-deep); }
.chat-preset-note { margin: -.2rem .15rem .85rem; color: var(--muted); font-size: .7rem; line-height: 1.4; }
.chat-other, .chat-edit { min-height: 44px; padding: .4rem .1rem; color: var(--muted); background: transparent; font-size: .8rem; text-decoration: underline; text-underline-offset: .2rem; }
.chat-other { display: block; margin-left: auto; }
.chat-compose { display: flex; gap: .45rem; align-items: flex-end; margin-top: 1.05rem; border: 1px solid #b8bdc3; border-radius: 24px; background: var(--paper-deep); padding: .3rem; }
.chat-compose:focus-within { border-color: var(--navy); box-shadow: 0 0 0 3px #e2e6ee; }
.chat-compose textarea { flex: 1; min-width: 0; min-height: 48px; max-height: 132px; padding: .7rem .65rem; resize: none; border: 0; background: transparent; font-size: 1rem; line-height: 1.5; }
.chat-compose textarea:focus-visible { box-shadow: none; }
.chat-compose button { flex: 0 0 44px; width: 44px; height: 44px; margin-bottom: .15rem; display: grid; place-items: center; border-radius: 50%; color: white; background: var(--navy); }
.chat-compose button:hover { background: var(--navy-light); }
.chat-privacy { margin: .65rem .2rem 0; color: var(--muted); font-size: .7rem; line-height: 1.45; }
.chat-privacy a { text-underline-offset: .15rem; }
.chat-test-note { margin: .8rem 1.2rem 1rem; color: var(--muted); font-size: .68rem; text-align: center; }
.chat-contact-details { padding-top: 1.1rem; margin-top: .3rem; border-top: 1px solid var(--line); }
.chat-contact-details h3 { font-size: 1.2rem; margin-bottom: 1rem; }
.chat-contact-details .field-grid { gap: .8rem; }
.chat-contact-details input { font-size: 1rem; }
.chat-final-actions { display: flex; gap: .75rem; justify-content: space-between; align-items: center; margin-top: 1rem; }
.chat-final-actions .submit-button { min-height: 44px; padding: .7rem .9rem; font-size: .9rem; }
.chat-reply-time { margin: .9rem 0 0; color: var(--muted); font-size: .78rem; line-height: 1.45; }
.chat-from-price { width: 100%; margin-top: 1.2rem; }
.chat-shell .form-success { margin: .7rem 0; }
.chat-shell [aria-invalid="true"] { border-color: #9c3327; }
.chat-article-link { min-height: 44px; padding: .25rem 0; background: transparent; color: inherit; font: inherit; text-align: left; text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: .2em; }
.chat-article-link:hover { text-decoration-thickness: 2px; }
.chat-article-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.chat-draft-note { margin: .8rem .2rem 0; color: var(--muted); font-size: .7rem; line-height: 1.4; }
.chat-draft-note button { min-height: 36px; padding: .25rem .2rem; background: transparent; color: inherit; font: inherit; text-decoration: underline; text-underline-offset: .2em; }
.chat-reader { height: min(74dvh, 720px); min-height: 360px; display: flex; flex-direction: column; background: var(--paper); }
.chat-reader-toolbar { flex: 0 0 auto; padding: .65rem 1.2rem .8rem; border-bottom: 1px solid var(--line); background: var(--paper-deep); }
.chat-reader-toolbar p { margin: 0 0 .4rem; color: var(--muted); font-size: .68rem; }
.chat-reader-toolbar button { min-height: 44px; padding: .55rem .9rem; display: flex; align-items: center; gap: .65rem; border-radius: 24px; background: var(--navy); color: white; font-size: .88rem; font-weight: 600; }
.chat-reader-toolbar button span { font-size: 1.2rem; }
.chat-reader button:focus-visible, .chat-reader-scroll:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.chat-reader-scroll { min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; padding: 1.5rem 1.2rem 2rem; overflow-wrap: anywhere; animation: chat-reader-in .18s ease-out; }
.chat-reader .overline { margin-bottom: .5rem; font-size: .65rem; }
.chat-reader h2 { margin: 0 0 1.2rem; font-size: 1.45rem; line-height: 1.2; }
.chat-reader-content, #chat-reader-content { font-size: 1rem; line-height: 1.65; }
.chat-reader .story-body { max-width: none; font-size: 1rem; line-height: 1.65; }
.chat-reader .story-body section { margin-bottom: 2rem; }
.chat-reader .story-body h2 { margin-bottom: .8rem; font-size: 1.25rem; }
.chat-reader .story-body h3 { margin: 1.3rem 0 .6rem; }
.chat-reader p, .chat-reader .story-body p { margin-bottom: 1rem; }
.chat-reader .story-body blockquote { padding-left: .9rem; border-left: 2px solid var(--accent); }
.chat-reader .story-media, .chat-reader .story-media-wide { width: 100%; max-width: 100%; margin: 1.5rem 0; transform: none; }
.chat-reader img { max-width: 100%; height: auto; }
.chat-reader-cover { display: block; width: 100%; margin-bottom: 1.6rem; border: 1px solid var(--line); }
.chat-reader .followup-example-label { margin-top: 1.7rem; font-weight: 600; }
.chat-reader .followup-steps { min-height: 0; margin-top: 1rem; display: grid; grid-template-columns: 1fr; gap: 1.1rem; }
.chat-reader .followup-steps::after, .chat-reader .followup-steps li::before { display: none; }
.chat-reader .followup-steps li:nth-child(n) { min-height: 0; margin: 0; padding: 0 0 0 1rem; border-left: 2px solid var(--accent); }
.chat-reader .followup-steps .step-number { margin-bottom: .3rem; }
.chat-reader .followup-steps p { margin: 0; }
.chat-reader-end { margin: 1.8rem 0 0; padding: 1.25rem 1rem; border: 1px solid var(--line); border-radius: 18px; background: var(--paper-deep); }
.chat-reader-end p { margin: 0 0 .5rem; font-weight: 600; }
.chat-reader-end button { min-height: 44px; padding: .4rem 0; display: flex; align-items: center; gap: .6rem; color: var(--navy); background: transparent; font: inherit; text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: .2em; }
.chat-reader-end.is-seen { animation: chat-return-cue .45s ease-out; }
@keyframes chat-return-cue { from { opacity: .45; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes chat-reader-in { from { opacity: .3; transform: translateX(12px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .chat-reader-scroll, .chat-reader-end.is-seen, .chat-message.chat-cue, .chat-compose.chat-cue { animation: none; } }
@media (max-width: 980px) {
  .chat-shell { width: 100%; max-width: 680px; min-width: 0; }
  .chat-conversation { max-height: 290px; }
}
@media (max-width: 540px) {
  .chat-shell { padding: 0; border-width: 3px; border-radius: 26px; }
  .chat-header { padding: .8rem; gap: .55rem; }
  .chat-shell .contact-panel, .chat-shell #guide-panel { padding: 1rem .8rem .2rem; }
  .chat-suggestions button { max-width: 100%; font-size: .88rem; }
  .chat-message { max-width: 96%; padding: .7rem .8rem; }
  .chat-message, .chat-compose textarea { font-size: 1rem; }
  .chat-contact-details .field-grid { grid-template-columns: 1fr; }
  .chat-final-actions { align-items: stretch; flex-direction: column-reverse; gap: .1rem; }
  .chat-test-badge { font-size: .6rem; }
  .chat-back { flex-basis: 32px; }
}

/* The production chat has no local-test footer. */
.chat-shell .contact-panel { padding-bottom: 1.2rem; }
.chat-reader-scroll { margin-bottom: 1rem; }

/* Local flow experiment: next steps belong to the current answer. */
.chat-reset { flex: 0 0 auto; min-height: 44px; max-width: 92px; padding: .35rem .2rem; border: 0; background: transparent; color: var(--muted); font-size: .76rem; line-height: 1.35; text-decoration: underline; text-underline-offset: .2em; }
.chat-reset:hover { color: var(--navy); }
.chat-reset:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
.chat-shell[data-reading="true"] .chat-reset { display: none; }
.chat-next .chat-next-prompt { margin-top: 1.2rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.chat-message .chat-next .chat-suggestions { align-items: flex-start; margin-top: .7rem; }
.chat-message .chat-next .chat-suggestions button { max-width: 100%; border-color: #c6c9cc; font-size: .88rem; background: var(--paper); }
.chat-message .chat-next .chat-suggestions button:hover { border-color: var(--navy); }
.chat-message .chat-next .chat-suggestions button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.chat-message .chat-next:has(.chat-next-prompt[hidden]) { margin-top: 1.1rem; }
.chat-shell[data-keyboard-open="true"] .chat-conversation { max-height: 130px; }
.chat-compose, .chat-contact-details input { scroll-margin-block: 14px; }
