/* ============================================================
 * Self-hosted typography (matches the designer's source spec).
 * Inter for UI, Plex Mono for meta lines, Fraunces for Soft/Editorial
 * skins' display type. Latin subset, swap behaviour.
 * ============================================================ */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(../fonts/inter-400-normal.woff2) format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(../fonts/inter-500-normal.woff2) format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(../fonts/inter-600-normal.woff2) format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(../fonts/inter-700-normal.woff2) format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(../fonts/plex-400-normal.woff2) format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(../fonts/plex-600-normal.woff2) format("woff2");
}
@font-face {
  font-family: "Fraunces";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(../fonts/fraunces-400-normal.woff2) format("woff2");
}
@font-face {
  font-family: "Fraunces";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(../fonts/fraunces-500-normal.woff2) format("woff2");
}
@font-face {
  font-family: "Fraunces";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url(../fonts/fraunces-400-italic.woff2) format("woff2");
}

/*
 * Auri Chat — visitor widget stylesheet (Pass 1.1)
 * Public theming API: see #auri-chat-root CSS custom properties below.
 * Tenant overrides shipped inline via auri_chat_render_root_style() PHP.
 * Pass 1.1: bubble offset CSS var (avoids back-to-top + sticky-add-to-cart),
 * mobile shell uses safe-area-inset + dynamic keyboard offset.
 */

/* ============================================================
 * 1. Sharp skin (Aurino default) — base custom properties
 * ============================================================ */
#auri-chat-root {
  /* Core surface + accent */
  --auri-accent:        #000000;
  --auri-accent-ink:    #ffffff;
  --auri-accent-soft:   #f0efeb;
  --auri-accent-deep:   #0a0a0a;
  --auri-bg:            #ffffff;
  --auri-surface:       #fafaf7;
  --auri-ink:           #0a0a0a;
  --auri-ink-soft:      #6e6e6e;
  --auri-head-bg:       #ffffff;
  --auri-head-ink:      #0a0a0a;

  /* Message bubbles */
  --auri-msg-user-bg:   #0a0a0a;
  --auri-msg-user-ink:  #ffffff;
  --auri-msg-bot-bg:    #f5f4f0;
  --auri-msg-bot-ink:   #0a0a0a;
  --auri-msg-line:      #e5e3dd;

  /* Shape + elevation */
  --auri-radius-window: 2px;
  --auri-radius-msg:    4px;
  --auri-radius-input:  2px;
  --auri-bubble-shape:  4px;
  --auri-bubble-size:   56px;
  --auri-bubble-size-m: 56px;
  --auri-shadow:        0 8px 28px rgba(0,0,0,0.16);

  /* Dynamic offsets (set by widget.js) */
  --auri-bubble-bottom: 24px;          /* lifted by JS when back-to-top / sticky-add-to-cart appears */
  --auri-keyboard-h:    0px;           /* set by visualViewport handler on mobile */

  /* Type */
  --auri-font:          "Inter", system-ui, -apple-system, sans-serif;
  --auri-font-display:  var(--auri-font);
  --auri-size-body:     14px;
  --auri-size-meta:     11px;

  /* Status */
  --auri-ok:            #2f7d4e;
  --auri-warn:          #a86b1f;
  --auri-danger:        #a8331f;

  /* Bubble chrome — dark regardless of accent so the glyph reads */
  --auri-bubble-bg:     #0a0a0a;
}

/* ============================================================
 * 2. Soft skin (warm retail)
 * ============================================================ */
#auri-chat-root[data-skin="soft"] {
  --auri-accent:        #0e7e72;
  --auri-accent-soft:   #e6f3f1;
  --auri-accent-deep:   #0a5d54;
  --auri-bg:            #faf7f1;
  --auri-surface:       #ffffff;
  --auri-ink:           #15181a;
  --auri-ink-soft:      #6b7177;
  --auri-head-bg:       #0f1f2a;
  --auri-head-ink:      #fafaf7;
  --auri-msg-user-bg:   #0f1f2a;
  --auri-msg-user-ink:  #fafaf7;
  --auri-msg-bot-bg:    #ffffff;
  --auri-msg-line:      #e5e2da;
  --auri-radius-window: 20px;
  --auri-radius-msg:    16px;
  --auri-radius-input:  999px;
  --auri-bubble-shape:  50%;
  --auri-bubble-size:   64px;
  --auri-bubble-size-m: 60px;
  --auri-bubble-bg:     #0f1f2a;
  --auri-font-display:  "Fraunces", Georgia, serif;
}

/* ============================================================
 * 3. Editorial skin (gallery / luxe)
 * ============================================================ */
#auri-chat-root[data-skin="editorial"] {
  --auri-accent:        #6b4a2a;
  --auri-accent-ink:    #fbf6ee;
  --auri-accent-soft:   #e8dcc4;
  --auri-accent-deep:   #4a2f15;
  --auri-bg:            #efe9e0;
  --auri-surface:       #fbf6ee;
  --auri-ink:           #2a1f17;
  --auri-ink-soft:      #7a6b5a;
  --auri-head-bg:       #fbf6ee;
  --auri-head-ink:      #2a1f17;
  --auri-msg-user-bg:   #2a1f17;
  --auri-msg-user-ink:  #fbf6ee;
  --auri-msg-bot-bg:    #fbf6ee;
  --auri-msg-line:      #d8cdba;
  --auri-radius-window: 8px;
  --auri-radius-msg:    8px;
  --auri-radius-input:  8px;
  --auri-bubble-shape:  8px;
  --auri-bubble-size:   68px;
  --auri-bubble-size-m: 62px;
  --auri-bubble-bg:     #2a1f17;
  --auri-font-display:  "Fraunces", Georgia, serif;
}

/* ============================================================
 * 4. Dark mode (auto via prefers-color-scheme)
 * ============================================================ */
@media (prefers-color-scheme: dark) {
  #auri-chat-root:not([data-color-scheme="light"]) {
    --auri-bg:           #0a141b;
    --auri-surface:      #0e1820;
    --auri-ink:          #ffffff;
    --auri-ink-soft:     rgba(255,255,255,0.6);
    --auri-head-bg:      #0e1820;
    --auri-head-ink:     #ffffff;
    --auri-msg-user-bg:  #ffffff;
    --auri-msg-user-ink: #0a0a0a;
    --auri-msg-bot-bg:   #1a2832;
    --auri-msg-bot-ink:  #ffffff;
    --auri-msg-line:     rgba(255,255,255,0.08);
    --auri-bubble-bg:    #ffffff;
  }
}

#auri-chat-root[data-color-scheme="dark"] {
  --auri-bg:           #0a141b;
  --auri-surface:      #0e1820;
  --auri-ink:          #ffffff;
  --auri-ink-soft:     rgba(255,255,255,0.6);
  --auri-head-bg:      #0e1820;
  --auri-head-ink:     #ffffff;
  --auri-msg-user-bg:  #ffffff;
  --auri-msg-user-ink: #0a0a0a;
  --auri-msg-bot-bg:   #1a2832;
  --auri-msg-bot-ink:  #ffffff;
  --auri-msg-line:     rgba(255,255,255,0.08);
  --auri-bubble-bg:    #ffffff;
}

/* Aurino visitor default: clean white chat, closer to the original widget. */
#auri-chat-root,
#auri-chat-root[data-color-scheme="auto"],
#auri-chat-root:not([data-color-scheme="dark"]) {
  --auri-accent:        #b08b4f;
  --auri-accent-ink:    #ffffff;
  --auri-accent-soft:   #f7f3ec;
  --auri-accent-deep:   #765729;
  --auri-bg:            #ffffff;
  --auri-surface:       #ffffff;
  --auri-ink:           #201a14;
  --auri-ink-soft:      #766b5c;
  --auri-head-bg:       #ffffff;
  --auri-head-ink:      #201a14;
  --auri-msg-user-bg:   #b08b4f;
  --auri-msg-user-ink:  #ffffff;
  --auri-msg-bot-bg:    #ffffff;
  --auri-msg-bot-ink:   #201a14;
  --auri-msg-line:      #e8e2d8;
  --auri-bubble-bg:     #ffffff;
  --auri-radius-window: 16px;
  --auri-radius-msg:    14px;
  --auri-radius-input:  14px;
  --auri-bubble-shape:  999px;
}

/* ============================================================
 * 5. Reset + isolation
 * ============================================================ */
#auri-chat-root,
#auri-chat-root *,
#auri-chat-root *::before,
#auri-chat-root *::after {
  box-sizing: border-box;
  font-family: var(--auri-font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
#auri-chat-root button {
  border: 0;
  background: transparent;
  font: inherit;
  color: inherit;
  cursor: pointer;
  padding: 0;
  margin: 0;
}
#auri-chat-root p,
#auri-chat-root ul,
#auri-chat-root ol,
#auri-chat-root figure,
#auri-chat-root blockquote {
  margin: 0;
  padding: 0;
}
#auri-chat-root img {
  display: block;
  max-width: 100%;
}

/* ============================================================
 * 6. Closed bubble + prompt — use --auri-bubble-bottom so JS
 * can lift them above .back-to-top / .sticky-add-to-cart
 * ============================================================ */
#auri-chat-bubble {
  position: fixed;
  inset-inline-end: 24px;
  bottom: var(--auri-bubble-bottom, 24px);
  width: var(--auri-bubble-size);
  height: var(--auri-bubble-size);
  border-radius: var(--auri-bubble-shape);
  background: var(--auri-bubble-bg);
  color: var(--auri-accent);
  box-shadow: 0 8px 28px rgba(0,0,0,0.18), 0 2px 6px rgba(0,0,0,0.08);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: bottom 220ms ease, transform 200ms ease, box-shadow 200ms ease;
}
#auri-chat-root[data-position="left"] #auri-chat-bubble {
  inset-inline-end: auto;
  inset-inline-start: 24px;
}
#auri-chat-bubble:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 14px 36px rgba(0,0,0,0.22), 0 3px 8px rgba(0,0,0,0.10);
}
#auri-chat-bubble:focus-visible {
  outline: 2px solid var(--auri-accent);
  outline-offset: 3px;
}
.auri-chat-bubble-glyph {
  width: 42%;
  height: 42%;
  stroke: var(--auri-accent);
  stroke-width: 2;
  fill: none;
}
#auri-chat-root[data-skin="sharp"] .auri-chat-bubble-glyph,
#auri-chat-root:not([data-skin]) .auri-chat-bubble-glyph {
  stroke: #d4af37; /* gold glyph on near-black bubble for Aurino default */
}
.auri-chat-bubble-online {
  position: absolute;
  top: 8px;
  inset-inline-end: 8px;
  width: 11px;
  height: 11px;
  border-radius: 999px;
  background: #3aa987;
  border: 2px solid var(--auri-bubble-bg);
}

.auri-chat-prompt {
  position: fixed;
  inset-inline-end: calc(var(--auri-bubble-size) + 36px);
  bottom: calc(var(--auri-bubble-bottom, 24px) + var(--auri-bubble-size) * 0.18);
  z-index: 99998;
  max-width: 220px;
  padding: 10px 14px;
  background: var(--auri-surface);
  color: var(--auri-ink);
  border: 1px solid var(--auri-msg-line);
  border-radius: 0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  line-height: 1.35;
  box-shadow: 0 10px 24px rgba(0,0,0,0.10);
  cursor: pointer;
  transition: bottom 220ms ease;
}
#auri-chat-root[data-position="left"] .auri-chat-prompt {
  inset-inline-end: auto;
  inset-inline-start: calc(var(--auri-bubble-size) + 36px);
}
#auri-chat-root[data-skin="soft"] .auri-chat-prompt {
  border-radius: 18px;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 600;
}
#auri-chat-root[data-skin="editorial"] .auri-chat-prompt {
  border-radius: 4px;
  font-family: var(--auri-font-display);
  font-style: italic;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
}
.auri-chat-prompt[hidden] { display: none !important; }

/* ============================================================
 * 7. Open window — desktop
 * ============================================================ */
#auri-chat-window {
  position: fixed;
  inset-inline-end: 20px;
  bottom: calc(var(--auri-bubble-bottom, 24px) + var(--auri-bubble-size) + 12px);
  width: 390px;
  height: 620px;
  max-height: calc(100dvh - 100px);
  background: var(--auri-bg);
  color: var(--auri-ink);
  border-radius: var(--auri-radius-window);
  overflow: hidden;
  box-shadow: 0 18px 60px rgba(0,0,0,0.22), 0 4px 12px rgba(0,0,0,0.08);
  z-index: 99999;
  display: flex;
  flex-direction: column;
}
#auri-chat-root[data-position="left"] #auri-chat-window {
  inset-inline-end: auto;
  inset-inline-start: 20px;
}
#auri-chat-window[hidden] { display: none; }

/* Header */
.auri-chat-head {
  flex: 0 0 auto;
  padding: 14px 16px 14px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--auri-head-bg);
  color: var(--auri-head-ink);
  border-bottom: 1px solid var(--auri-msg-line);
}
.auri-chat-head-avatar {
  flex: 0 0 auto;
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: var(--auri-accent);
  color: var(--auri-accent-ink);
  font-family: var(--auri-font-display);
  font-weight: 600;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-transform: uppercase;
  overflow: hidden;
}
.auri-chat-head-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 999px;
  object-fit: cover;
}
.auri-chat-head-avatar-dot {
  position: absolute;
  bottom: -2px;
  inset-inline-end: -2px;
  width: 11px;
  height: 11px;
  border-radius: 999px;
  background: #3aa987;
  border: 2px solid var(--auri-head-bg);
}
.auri-chat-head-title {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}
.auri-chat-head-title h2 {
  font-family: var(--auri-font-display);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0;
  margin: 0;
  color: var(--auri-head-ink);
}
.auri-chat-head-title span {
  font-size: 11.5px;
  opacity: 0.7;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.auri-chat-head-actions {
  display: flex;
  gap: 6px;
}
.auri-chat-head-actions button {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  opacity: 0.7;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 150ms ease, background-color 150ms ease;
}
.auri-chat-head-actions button:hover,
.auri-chat-head-actions button:focus-visible {
  opacity: 1;
  background-color: rgba(0,0,0,0.06);
}
@media (prefers-color-scheme: dark) {
  #auri-chat-root:not([data-color-scheme="light"]) .auri-chat-head-actions button:hover,
  #auri-chat-root:not([data-color-scheme="light"]) .auri-chat-head-actions button:focus-visible {
    background-color: rgba(255,255,255,0.08);
  }
}
.auri-chat-head-actions svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

/* Body */
.auri-chat-body {
  flex: 1 1 0%;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 18px 14px 8px;
  background: var(--auri-bg);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.auri-chat-day-divider {
  text-align: center;
  font-size: 10.5px;
  font-family: "IBM Plex Mono", Menlo, monospace;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--auri-ink-soft);
  margin: 8px 0;
}

/* Message bubble */
.auri-chat-msg {
  display: grid;
  grid-template-columns: 30px minmax(0, max-content);
  gap: 8px;
  max-width: 88%;
  align-items: end;
}
.auri-chat-msg[data-role="user"] {
  align-self: flex-end;
  grid-template-columns: minmax(0, max-content) 30px;
}
.auri-chat-msg[data-role="assistant"],
.auri-chat-msg[data-role="owner"] {
  align-self: flex-start;
}
.auri-chat-msg[data-role="system"] {
  align-self: center;
  display: flex;
  flex-direction: column;
  max-width: 92%;
}
.auri-chat-msg-avatar {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .02em;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .08);
}
.auri-chat-msg-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.auri-chat-msg[data-role="user"] .auri-chat-msg-avatar {
  grid-column: 2;
  grid-row: 1;
}
.auri-chat-msg[data-role="user"] .auri-chat-msg-bubble {
  grid-column: 1;
  grid-row: 1;
}
.auri-chat-msg-avatar[data-role="assistant"] {
  background: #fff;
  border: 1px solid var(--auri-msg-line);
  color: var(--auri-accent);
}
.auri-chat-msg-avatar[data-role="owner"],
.auri-chat-msg-avatar[data-tone="gold"] { background: #b08b4f; }
.auri-chat-msg-avatar[data-tone="sage"] { background: #5f7f6d; }
.auri-chat-msg-avatar[data-tone="clay"] { background: #a2684f; }
.auri-chat-msg-avatar[data-tone="navy"] { background: #24364a; }
.auri-chat-msg-avatar[data-tone="rose"] { background: #9d6672; }
.auri-chat-msg-avatar[data-tone="slate"] { background: #68717b; }
.auri-chat-msg-avatar[data-role="assistant"][data-tone] {
  background: #fff;
}
.auri-chat-msg-bubble {
  min-width: 0;
  padding: 10px 14px;
  font-size: 13.5px;
  line-height: 1.5;
  border-radius: var(--auri-radius-msg);
  word-wrap: break-word;
}
.auri-chat-msg[data-role="user"] .auri-chat-msg-bubble {
  background: var(--auri-msg-user-bg);
  color: var(--auri-msg-user-ink);
  border-end-end-radius: max(2px, calc(var(--auri-radius-msg) - 8px));
}
.auri-chat-msg[data-role="assistant"] .auri-chat-msg-bubble,
.auri-chat-msg[data-role="owner"] .auri-chat-msg-bubble {
  background: var(--auri-msg-bot-bg);
  color: var(--auri-msg-bot-ink);
  border: 1px solid var(--auri-msg-line);
  border-end-start-radius: max(2px, calc(var(--auri-radius-msg) - 8px));
}
.auri-chat-msg[data-role="system"] .auri-chat-msg-bubble {
  background: transparent;
  border: 0;
  color: var(--auri-ink-soft);
  font-size: 11.5px;
  text-align: center;
  align-self: center;
  padding: 4px 8px;
}
.auri-chat-msg-bubble a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.auri-chat-msg-time {
  font-size: 10.5px;
  color: var(--auri-ink-soft);
  margin-top: 4px;
  font-family: "IBM Plex Mono", Menlo, monospace;
}
.auri-chat-msg-time[hidden] { display: none; }

/* Footer / composer */
.auri-chat-foot {
  flex: 0 0 auto;
  padding: 12px 14px 14px;
  background: var(--auri-bg);
  border-top: 1px solid var(--auri-msg-line);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.auri-chat-composer {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: #fff;
  border: 1px solid var(--auri-msg-line);
  border-radius: var(--auri-radius-input);
  padding: 8px;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}
.auri-chat-composer:focus-within {
  border-color: var(--auri-accent);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--auri-accent), transparent 86%);
}
#auri-chat-input {
  flex: 1;
  border: 0 !important;
  outline: 0;
  background: transparent;
  padding: 8px 10px;
  font-size: 16px; /* 16px prevents iOS zoom-on-focus */
  color: var(--auri-ink);
  resize: none;
  min-height: 40px;
  max-height: none;
  line-height: 1.4;
  font-family: var(--auri-font);
  overflow: hidden;
  scrollbar-width: none;
  box-shadow: none !important;
  appearance: none;
  -webkit-appearance: none;
}
#auri-chat-input::-webkit-scrollbar { display: none; }
#auri-chat-input::placeholder { color: var(--auri-ink-soft); }
#auri-chat-send {
  flex: 0 0 auto;
  background: var(--auri-accent);
  color: var(--auri-accent-ink);
  border-radius: calc(var(--auri-radius-input) - 2px);
  min-width: 44px;
  min-height: 40px;
  padding: 0 16px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: opacity 150ms ease, transform 100ms ease;
}
#auri-chat-root[data-skin="soft"] #auri-chat-send,
#auri-chat-root[data-skin="editorial"] #auri-chat-send {
  text-transform: none;
  font-weight: 600;
  letter-spacing: 0;
}
#auri-chat-send:hover { opacity: 0.92; }
#auri-chat-send:active { transform: scale(0.98); }
#auri-chat-send:disabled { opacity: 0.5; cursor: not-allowed; }
#auri-chat-send svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}
@media (max-width: 480px) {
  .auri-chat-send-label { display: none; }
}

.auri-chat-gdpr {
  text-align: center;
  font-size: 10px;
  color: var(--auri-ink-soft);
  opacity: 0.7;
  line-height: 1.4;
}
.auri-chat-gdpr a {
  color: inherit;
  text-decoration: underline;
}

/* ============================================================
 * 8. Mobile shell — fill viewport, safe-area-inset, keyboard-aware
 * ============================================================ */
@media (max-width: 480px) {
  #auri-chat-bubble {
    width: var(--auri-bubble-size-m);
    height: var(--auri-bubble-size-m);
    inset-inline-end: 16px;
    bottom: var(--auri-bubble-bottom, 18px);
  }
  .auri-chat-prompt {
    max-width: 180px;
    inset-inline-end: calc(var(--auri-bubble-size-m) + 24px);
    bottom: calc(var(--auri-bubble-bottom, 18px) + var(--auri-bubble-size-m) * 0.18);
  }
  #auri-chat-window {
    /* Fill the visible viewport with a small inset for breathing room */
    inset-inline-start: 8px;
    inset-inline-end: 8px;
    top: max(8px, env(safe-area-inset-top, 8px));
    /* When the keyboard is up, --auri-keyboard-h is set by JS so the window
     * lifts above it. visualViewport reports the keyboard height. */
    bottom: calc(var(--auri-keyboard-h, 0px) + max(8px, env(safe-area-inset-bottom, 8px)));
    width: auto;
    height: auto;
    max-height: none;
    min-height: 0;
    border-radius: 18px;
    box-shadow: 0 24px 60px rgba(0,0,0,0.32);
  }
  /* Composer keeps a comfortable bottom padding even without safe-area */
  .auri-chat-foot {
    padding-bottom: max(14px, env(safe-area-inset-bottom, 14px));
  }
  /* Slightly larger close target on touch */
  .auri-chat-head-actions button {
    width: 40px;
    height: 40px;
  }
}

/* ============================================================
 * 8b. Widget states (Pass 2C — ticket 04)
 *     typing dots · product card · contact card · takeover
 *     banner · inline send error · long-reply collapse
 * ============================================================ */

/* ---- typing indicator ---- */
.auri-chat-msg[data-state="typing"] .auri-chat-msg-bubble {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 12px 14px;
  min-height: 38px;
}
.auri-chat-typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.auri-chat-typing-dots span {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--auri-ink-soft);
  opacity: 0.5;
  animation: auri-typing-pulse 1.2s infinite ease-in-out;
}
.auri-chat-typing-dots span:nth-child(2) { animation-delay: 0.16s; }
.auri-chat-typing-dots span:nth-child(3) { animation-delay: 0.32s; }
@keyframes auri-typing-pulse {
  0%, 80%, 100% { opacity: 0.35; transform: scale(0.9); }
  40%           { opacity: 1;    transform: scale(1.1); }
}

/* ---- inline product card ---- */
.auri-chat-product-card {
  background: var(--auri-surface);
  border: 1px solid var(--auri-msg-line);
  border-radius: max(8px, calc(var(--auri-radius-msg) * 2));
  overflow: hidden;
  display: grid;
  grid-template-columns: 84px 1fr;
  align-self: flex-start;
  width: 100%;
  max-width: 320px;
  margin: 6px 0 4px;
  font-size: 13.5px;
}
.auri-chat-product-image {
  display: block;
  width: 84px;
  height: 84px;
  background: var(--auri-bg);
}
.auri-chat-product-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.auri-chat-product-body {
  padding: 10px 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.auri-chat-product-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--auri-ink);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.auri-chat-product-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
}
.auri-chat-product-price {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--auri-ink);
}
.auri-chat-product-stock {
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.auri-chat-product-stock[data-tone="ok"]  { background: #e6f2eb; color: #2f7d4e; }
.auri-chat-product-stock[data-tone="out"] { background: #fbe7e2; color: #a8331f; }
.auri-chat-product-cta {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-top: 1px solid var(--auri-msg-line);
  padding: 9px 14px;
  color: var(--auri-accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-decoration: none;
  transition: background-color 120ms ease;
}
.auri-chat-product-cta:hover,
.auri-chat-product-cta:focus-visible {
  background: var(--auri-accent-soft);
}
#auri-chat-root[data-skin="soft"] .auri-chat-product-cta,
#auri-chat-root[data-skin="editorial"] .auri-chat-product-cta {
  text-transform: none;
  font-weight: 600;
  letter-spacing: 0;
}

/* ---- in-conversation contact capture card ---- */
.auri-chat-msg[data-card="contact"] {
  align-self: flex-start;
  display: flex;
  flex-direction: column;
  max-width: 92%;
}
.auri-chat-capture {
  background: var(--auri-surface);
  border: 1px solid var(--auri-msg-line);
  border-radius: max(10px, calc(var(--auri-radius-msg) * 2));
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.auri-chat-capture-eyebrow {
  font-size: 10.5px;
  font-family: "IBM Plex Mono", Menlo, monospace;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--auri-ink-soft);
  margin-bottom: 4px;
}
.auri-chat-capture label {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.auri-chat-capture label span {
  font-size: 10.5px;
  color: var(--auri-ink-soft);
}
.auri-chat-capture input {
  border: 1px solid var(--auri-msg-line);
  border-radius: 8px;
  padding: 9px 11px;
  font-size: 14px;
  background: var(--auri-bg);
  color: var(--auri-ink);
  outline: 0;
  font-family: var(--auri-font);
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.auri-chat-capture input:focus {
  border-color: var(--auri-accent);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--auri-accent), transparent 86%);
}
.auri-chat-capture-submit {
  background: var(--auri-accent);
  color: var(--auri-accent-ink);
  border-radius: var(--auri-radius-input);
  padding: 11px 14px;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-top: 4px;
}
#auri-chat-root[data-skin="soft"] .auri-chat-capture-submit,
#auri-chat-root[data-skin="editorial"] .auri-chat-capture-submit {
  text-transform: none;
  font-weight: 600;
  letter-spacing: 0;
}
.auri-chat-capture-skip {
  background: transparent;
  color: var(--auri-ink-soft);
  font-size: 11px;
  padding: 4px;
  text-decoration: underline;
  text-underline-offset: 2px;
  align-self: center;
}
.auri-chat-capture-thanks {
  font-size: 12.5px;
  color: var(--auri-accent-deep);
  font-weight: 600;
  text-align: center;
}

/* ---- takeover banner (once per session) ---- */
.auri-chat-takeover-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--auri-accent-soft);
  border: 1px solid color-mix(in oklab, var(--auri-accent), transparent 86%);
  border-radius: max(8px, calc(var(--auri-radius-msg) * 2));
  padding: 8px 12px;
  font-size: 12px;
  color: var(--auri-accent-deep);
  align-self: stretch;
  margin: 4px 0;
}
.auri-chat-avatar-mini {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: var(--auri-accent);
  color: var(--auri-accent-ink);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
  flex: 0 0 auto;
}
.auri-chat-takeover-text strong { font-weight: 700; }

/* ---- inline send-failure retry (under user bubble) ---- */
.auri-chat-msg-status {
  font-size: 11.5px;
  color: var(--auri-danger);
  margin-top: 4px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  align-self: flex-end;
}
.auri-chat-msg-status button {
  background: transparent;
  color: var(--auri-danger);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
  font-size: 11.5px;
}

/* ---- typing indicator status line + reasoning preview ---- */
.auri-chat-typing-status {
  font-size: 12px;
  color: var(--auri-ink-soft);
  font-style: italic;
  margin-inline-start: 8px;
}
.auri-chat-reasoning {
  align-self: flex-start;
  max-width: 90%;
  margin: 2px 0 4px;
  padding: 8px 12px;
  font-size: 11.5px;
  color: var(--auri-ink-soft);
  border: 1px dashed var(--auri-msg-line);
  border-radius: 12px;
  background: transparent;
  line-height: 1.4;
}

/* ---- suggestion chips above composer ---- */
.auri-chat-suggestions {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 0 8px;
  scrollbar-width: none;
}
.auri-chat-suggestions::-webkit-scrollbar { display: none; }
.auri-chat-suggestions[hidden] { display: none; }
.auri-chat-suggestion {
  flex: 0 0 auto;
  padding: 6px 12px;
  background: var(--auri-surface);
  border: 1px solid var(--auri-msg-line);
  color: var(--auri-ink);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 120ms ease, border-color 120ms ease;
}
.auri-chat-suggestion:hover {
  background: var(--auri-bg);
  border-color: var(--auri-accent);
  color: var(--auri-accent);
}

/* ---- quick-reply chips below owner messages ---- */
.auri-chat-quick-replies {
  align-self: flex-end;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  max-width: 82%;
  margin: 2px 0 6px;
}
.auri-chat-quick-reply {
  padding: 7px 12px;
  font-size: 12.5px;
  font-weight: 600;
  border-radius: var(--auri-radius-input);
  background: var(--auri-surface);
  border: 1px solid var(--auri-msg-line);
  color: var(--auri-ink);
  cursor: pointer;
  transition: background-color 120ms ease, border-color 120ms ease;
}
.auri-chat-quick-reply[data-primary="true"] {
  background: var(--auri-accent);
  border-color: var(--auri-accent);
  color: var(--auri-accent-ink);
}
.auri-chat-quick-reply:hover { opacity: 0.92; }

/* ---- product variant chips ---- */
.auri-chat-product-variants {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 6px;
}
.auri-chat-chip {
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--auri-msg-line);
  background: transparent;
  font-size: 11px;
  font-weight: 500;
  color: var(--auri-ink);
  cursor: pointer;
  transition: background-color 120ms ease, color 120ms ease;
}
.auri-chat-chip[aria-pressed="true"] {
  background: var(--auri-ink);
  color: var(--auri-bg);
  border-color: var(--auri-ink);
}
.auri-chat-chip[data-overflow="true"] {
  color: var(--auri-ink-soft);
}

/* ---- long-reply collapse ---- */
.auri-chat-msg-bubble[data-collapsed="true"] {
  position: relative;
  max-height: 14em;
  overflow: hidden;
}
.auri-chat-msg-bubble[data-collapsed="true"]::after {
  content: "";
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  height: 3em;
  background: linear-gradient(to bottom, transparent, var(--auri-msg-bot-bg));
  pointer-events: none;
}
.auri-chat-msg-expand {
  margin-top: 4px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--auri-accent-deep);
  text-decoration: underline;
  text-underline-offset: 2px;
  align-self: flex-start;
}

/* ============================================================
 * 9. Reduced motion (ticket 07 — explicit alts)
 * Blanket: zero all transitions/animations.
 * Then: restore visibility for things that animation made readable
 * (typing dots must still be visible without their pulse).
 * ============================================================ */
@media (prefers-reduced-motion: reduce) {
  #auri-chat-root *,
  #auri-chat-root *::before,
  #auri-chat-root *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  /* Typing dots: animation is killed, so leave them readable at uniform opacity */
  #auri-chat-root .auri-chat-typing-dots span {
    opacity: 0.7 !important;
    transform: none !important;
  }
  /* Bubble hover lift: don't translate on hover */
  #auri-chat-root #auri-chat-bubble:hover {
    transform: none !important;
  }
}

/* ============================================================
 * 10. Screen-reader only utility
 * ============================================================ */
.auri-chat-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
