/* Public Chat — mobile-first, WhatsApp-familiar layout */
/* No WA trade dress: no #25D366/#075E54, no WA wallpaper */

:root {
  --accent: #2563EB;
  --bg: #f0f2f5;
  --header-bg: var(--accent);
  --header-text: #ffffff;
  --bubble-user: var(--accent);
  --bubble-user-text: #ffffff;
  --bubble-assistant: #ffffff;
  --bubble-assistant-text: #1a1a1a;
  --bubble-assistant-border: #e0e0e0;
  --composer-bg: #ffffff;
  --composer-border: #e0e0e0;
  --input-bg: #f5f5f5;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%; font-family: var(--font); font-size: 15px;
  line-height: 1.45; background: var(--bg); color: #1a1a1a;
  -webkit-text-size-adjust: 100%;
}
body { display: flex; flex-direction: column; }

/* ===== HEADER ===== */
.pc-header {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; background: var(--header-bg);
  color: var(--header-text); min-height: 56px; flex-shrink: 0;
}
.pc-header-logo {
  width: 36px; height: 36px; border-radius: 50%;
  object-fit: cover; background: rgba(255,255,255,0.2);
}
.pc-header-name {
  font-size: 1.05rem; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ===== MESSAGES ===== */
.pc-messages {
  flex: 1; overflow-y: auto; padding: 12px 12px 8px;
  display: flex; flex-direction: column; gap: 6px;
  -webkit-overflow-scrolling: touch;
}

/* ===== BUBBLES ===== */
.pc-bubble {
  max-width: 82%; padding: 9px 13px; border-radius: 16px;
  /* `anywhere`, not `break-word`: both allow breaking inside a long unbroken
     run like a payment URL, but only `anywhere` lowers the element's
     min-content width, which is what stops an ancestor flex/grid track from
     being forced wider than the chat column. word-wrap kept for old engines. */
  word-wrap: break-word; overflow-wrap: anywhere;
  min-width: 0;
  white-space: pre-wrap; animation: pc-fadeIn 0.15s ease-out;
}
.pc-bubble-user {
  align-self: flex-end; background: var(--bubble-user);
  color: var(--bubble-user-text); border-bottom-right-radius: 4px;
}
.pc-bubble-assistant {
  align-self: flex-start; background: var(--bubble-assistant);
  color: var(--bubble-assistant-text);
  border: 1px solid var(--bubble-assistant-border);
  border-bottom-left-radius: 4px;
}
.pc-bubble-text { margin: 0; }
.pc-bubble-time {
  display: block; font-size: 0.7rem; opacity: 0.6;
  margin-top: 3px; text-align: right;
}

/* ===== CONSENT ===== */
.pc-consent { text-align: center; padding: 6px 16px; color: #888; font-size: 0.75rem; }

/* ===== TYPING INDICATOR ===== */
.pc-typing {
  align-self: flex-start; display: flex; align-items: center;
  gap: 4px; padding: 10px 16px;
  background: var(--bubble-assistant);
  border: 1px solid var(--bubble-assistant-border);
  border-radius: 16px; border-bottom-left-radius: 4px;
}
.pc-typing-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #999; animation: pc-typingBounce 1.2s infinite;
}
.pc-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.pc-typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes pc-typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-5px); opacity: 1; }
}
@keyframes pc-fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== COMPOSER ===== */
.pc-composer {
  position: sticky; bottom: 0; z-index: 10;
  background: var(--composer-bg);
  border-top: 1px solid var(--composer-border);
  padding: 8px 10px;
  padding-bottom: max(8px, env(safe-area-inset-bottom));
  flex-shrink: 0;
}
.pc-composer-inner {
  display: flex; align-items: center; gap: 6px;
  position: relative;
}
.pc-input {
  flex: 1; padding: 10px 14px; border: none; border-radius: 22px;
  background: var(--input-bg); font-family: var(--font);
  font-size: 0.95rem; outline: none; min-width: 0;
}
.pc-input:focus { box-shadow: 0 0 0 2px var(--accent); }

/* Icon buttons (emoji, attach, mic) */
.pc-icon-btn {
  width: 38px; height: 38px; border: none; border-radius: 50%;
  background: transparent; color: #666; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: color 0.15s;
}
.pc-icon-btn:hover { color: var(--accent); }

/* Send button */
.pc-send-btn {
  width: 40px; height: 40px; border: none; border-radius: 50%;
  background: var(--accent); color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: opacity 0.15s;
}
.pc-send-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.pc-send-btn:not(:disabled):hover { opacity: 0.85; }

/* Mic button accent style */
.pc-mic-btn { color: #666; }

/* ===== RECORDING BAR ===== */
.pc-rec-bar {
  display: flex; align-items: center; gap: 8px;
  position: absolute; left: 0; right: 0; top: 0; bottom: 0;
  background: var(--composer-bg); padding: 0 10px;
  border-radius: 22px; z-index: 5;
}
.pc-rec-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: #e53e3e; animation: pc-recPulse 1s infinite;
}
@keyframes pc-recPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}
.pc-rec-timer { font-size: 0.9rem; color: #333; min-width: 38px; }
.pc-rec-trash { color: #e53e3e; }
.pc-rec-send {
  margin-left: auto;
  width: 38px; height: 38px; border: none; border-radius: 50%;
  background: var(--accent); color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}

/* Hide normal controls in recording mode */
/* .pc-input and .pc-attach-toggle now live inside .pc-fieldwrap, so they are
   no longer direct children here — hiding the wrapper covers both, plus the
   camera button. Listing the old two as well would be dead selectors. */
.pc-composer-inner.pc-recording > .pc-emoji-toggle,
.pc-composer-inner.pc-recording > .pc-fieldwrap,
.pc-composer-inner.pc-recording > .pc-mic-btn,
.pc-composer-inner.pc-recording > .pc-send-btn { display: none !important; }
.pc-composer-inner.pc-recording > .pc-rec-bar { display: flex !important; }

/* ===== ATTACH MENU ===== */
.pc-attach-menu {
  position: absolute; bottom: 100%; left: 0; right: 0;
  background: #fff; border: 1px solid #e0e0e0;
  border-radius: 12px; margin-bottom: 6px; padding: 6px 0;
  box-shadow: 0 4px 16px rgba(0,0,0,0.1); z-index: 20;
  animation: pc-fadeIn 0.12s ease-out;
}
.pc-attach-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 10px 16px; border: none; background: none;
  font-size: 0.95rem; cursor: pointer; text-align: left;
  font-family: var(--font); color: #333;
}
.pc-attach-item:hover { background: #f5f5f5; }

/* ===== EMOJI PICKER ===== */
.pc-emoji-panel {
  position: absolute; bottom: 100%; left: 0;
  width: 280px; max-height: 200px; overflow-y: auto;
  background: #fff; border: 1px solid #e0e0e0;
  border-radius: 12px; margin-bottom: 6px; padding: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.1); z-index: 20;
  display: flex; flex-wrap: wrap; gap: 2px;
  animation: pc-fadeIn 0.12s ease-out;
}
.pc-emoji-btn {
  width: 34px; height: 34px; border: none; background: none;
  font-size: 1.3rem; cursor: pointer; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
}
.pc-emoji-btn:hover { background: #f0f0f0; }

/* ===== MEDIA BUBBLES ===== */
/* Image */
.pc-media-image { margin-bottom: 4px; }
.pc-media-image img {
  max-width: 100%; border-radius: 10px; cursor: pointer;
  display: block;
}
.pc-media-thumb {
  max-width: 200px; max-height: 200px; border-radius: 10px;
  display: block; object-fit: cover;
}

/* Video */
.pc-media-video { margin-bottom: 4px; }
.pc-media-video video {
  max-width: 100%; border-radius: 10px; display: block;
}

/* Audio / Voice note */
.pc-media-audio {
  display: flex; align-items: center; gap: 8px;
  min-width: 180px; padding: 4px 0;
}
/* Shared GPS pin — pin glyph + a link out to Google Maps, the same shape the
   admin inbox draws for a WhatsApp location. */
.pc-media-location {
  display: flex; align-items: center; gap: 8px; padding: 2px 0;
}
.pc-loc-pin { font-size: 1.15rem; line-height: 1; flex-shrink: 0; }
.pc-media-location a {
  color: inherit; text-decoration: underline; word-break: break-word;
}
.pc-audio-play {
  width: 32px; height: 32px; border: none; border-radius: 50%;
  background: var(--accent); color: #fff; cursor: pointer;
  font-size: 0.75rem; display: flex; align-items: center;
  justify-content: center; flex-shrink: 0;
}
.pc-audio-progress {
  flex: 1; height: 4px; background: #ddd; border-radius: 2px;
  overflow: hidden;
}
.pc-audio-bar {
  height: 100%; width: 0%; background: var(--accent);
  border-radius: 2px; transition: width 0.2s linear;
}
.pc-audio-dur { font-size: 0.75rem; color: inherit; opacity: 0.7; min-width: 30px; }
.pc-bubble-user .pc-audio-play { background: rgba(255,255,255,0.3); }
.pc-bubble-user .pc-audio-progress { background: rgba(255,255,255,0.3); }
.pc-bubble-user .pc-audio-bar { background: #fff; }

/* Document */
.pc-media-doc {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 0;
}
.pc-doc-icon { font-size: 1.6rem; flex-shrink: 0; }
.pc-doc-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pc-doc-name {
  font-size: 0.85rem; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 180px;
}
.pc-doc-download {
  font-size: 0.75rem; color: var(--accent); text-decoration: none;
}
.pc-doc-download:hover { text-decoration: underline; }
.pc-bubble-user .pc-doc-download { color: rgba(255,255,255,0.85); }

/* ===== LIGHTBOX ===== */
.pc-lightbox {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,0.85); display: flex;
  align-items: center; justify-content: center;
  animation: pc-fadeIn 0.15s ease-out;
}
.pc-lightbox-img { max-width: 95%; max-height: 90vh; border-radius: 4px; }
.pc-lightbox-close {
  position: absolute; top: 12px; right: 16px;
  background: none; border: none; color: #fff;
  font-size: 2rem; cursor: pointer; line-height: 1;
}

/* ===== TOAST ===== */
.pc-toast {
  position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%);
  background: #333; color: #fff; padding: 10px 20px;
  border-radius: 20px; font-size: 0.85rem; z-index: 100;
  animation: pc-toastIn 0.3s ease-out;
  pointer-events: none;
}
@keyframes pc-toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(10px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ===== INTERACTIVE BUTTONS / LISTS ===== */
.pc-interactive { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.pc-interactive-btn {
  width: 100%; padding: 10px 14px; border: 1px solid var(--accent);
  border-radius: 10px; background: #fff; color: var(--accent);
  font-family: var(--font); font-size: 0.9rem; font-weight: 500;
  cursor: pointer; text-align: center; transition: background 0.15s, color 0.15s;
}
.pc-interactive-btn:hover { background: var(--accent); color: #fff; }
.pc-interactive-list-header { font-weight: 600; font-size: 0.9rem; margin-bottom: 2px; }
.pc-interactive-section-title { font-weight: 600; font-size: 0.8rem; color: #666; margin-top: 4px; }
.pc-interactive-row {
  width: 100%; padding: 8px 12px; border: 1px solid #e0e0e0;
  border-radius: 8px; background: #fff; cursor: pointer; text-align: left;
  font-family: var(--font); transition: background 0.15s;
}
.pc-interactive-row:hover { background: #f5f5f5; }
.pc-interactive-row-title { font-size: 0.9rem; font-weight: 500; color: #1a1a1a; }
.pc-interactive-row-desc { font-size: 0.78rem; color: #666; margin-top: 2px; }
/* "Already chosen" affordance only — must stay tappable so a customer can
   scroll back and pick a different option (the server bounds validity). */
.pc-interactive-used .pc-interactive-btn,
.pc-interactive-used .pc-interactive-row {
  opacity: 0.65;
}

/* ===== RESPONSIVE ===== */
@media (min-width: 600px) {
  body {
    max-width: 480px; margin: 0 auto;
    border-left: 1px solid #ddd; border-right: 1px solid #ddd;
  }
}
@media (min-width: 1024px) {
  body {
    max-width: 420px; margin-top: 24px; margin-bottom: 24px;
    border-radius: 12px; overflow: hidden;
    height: calc(100% - 48px); border: 1px solid #ccc;
    box-shadow: 0 4px 24px rgba(0,0,0,0.08);
  }
}

/* ---- Rich web components (item 9) --------------------------------------
   Web-chat only. WhatsApp and Instagram have no equivalent primitive, so
   these degrade to plain text there rather than rendering. */
.pc-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.pc-chip { border: 1px solid var(--accent, #2563eb); color: var(--accent, #2563eb);
  background: #fff; border-radius: 999px; padding: 5px 12px; font-size: 13px;
  cursor: pointer; }
.pc-chip:hover { background: rgba(37, 99, 235, .06); }

/* Horizontal scroll is intentional: cards must never squash to fit. */
.pc-carousel { display: flex; gap: 10px; overflow-x: auto; padding: 6px 2px 2px;
  scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; }
.pc-card { position: relative; flex: 0 0 190px; scroll-snap-align: start;
  border: 1px solid #e5e7eb; border-radius: 12px; overflow: hidden;
  background: #fff; display: flex; flex-direction: column; }
.pc-card-img { width: 100%; height: 110px; object-fit: cover; display: block; }
.pc-card-badge { position: absolute; top: 8px; left: 8px; background: #111827;
  color: #fff; font-size: 10px; padding: 2px 7px; border-radius: 999px; }
.pc-card-title { font-size: 13px; font-weight: 600; padding: 8px 10px 0; }
.pc-card-sub { font-size: 11px; color: #6b7280; padding: 2px 10px 0; }
.pc-card-price { font-size: 13px; font-weight: 700; padding: 4px 10px 0; }
.pc-card-btn { margin: 8px 10px 10px; border: none; border-radius: 8px;
  background: var(--accent, #2563eb); color: #fff; padding: 7px 0;
  font-size: 13px; cursor: pointer; }

.pc-gallery { display: grid; grid-template-columns: 1fr 1fr; gap: 4px;
  margin-top: 6px; }
.pc-gallery-cell { position: relative; border-radius: 8px; overflow: hidden;
  cursor: pointer; }
.pc-gallery-cell img { width: 100%; height: 92px; object-fit: cover;
  display: block; }
.pc-gallery-more { position: absolute; inset: 0; display: flex;
  align-items: center; justify-content: center; background: rgba(0,0,0,.45);
  color: #fff; font-size: 13px; font-weight: 600; }

.pc-price-row { display: flex; justify-content: space-between; align-items: center;
  width: 100%; gap: 10px; text-align: left; background: #fff;
  border: 1px solid #e5e7eb; border-radius: 10px; padding: 9px 11px;
  margin-top: 6px; cursor: pointer; }
.pc-price-row:hover { border-color: var(--accent, #2563eb); }
.pc-price-title { font-size: 13px; font-weight: 600; }
.pc-price-desc { font-size: 11px; color: #6b7280; margin-top: 1px; }
.pc-price-amount { font-size: 13px; font-weight: 700; white-space: nowrap; }

.pc-dates, .pc-slots { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.pc-date, .pc-slot { border: 1px solid #d1d5db; background: #fff;
  border-radius: 8px; padding: 6px 11px; font-size: 13px; cursor: pointer; }
.pc-date:hover, .pc-slot:hover { border-color: var(--accent, #2563eb);
  color: var(--accent, #2563eb); }

.pc-confirm { border: 1px solid #e5e7eb; border-radius: 12px; padding: 10px 12px;
  margin-top: 6px; background: #fff; }
.pc-confirm-row { display: flex; justify-content: space-between; gap: 12px;
  font-size: 13px; padding: 3px 0; }
.pc-confirm-key { color: #6b7280; }
/* min-width:0 is load-bearing: .pc-confirm-row is a flex container, and a flex
   item defaults to min-width:auto, which REFUSES to shrink below its content.
   A payment URL or a long VA number therefore pushed the row wider than the
   card and spilled out of it. `anywhere` rather than `break-word` because only
   `anywhere` also lowers the min-content width, which is what lets the flex
   item shrink in the first place. */
.pc-confirm-val {
  font-weight: 600; text-align: right;
  min-width: 0; overflow-wrap: anywhere;
}
.pc-confirm-btn { width: 100%; margin-top: 10px; border: none; border-radius: 8px;
  background: var(--accent, #2563eb); color: #fff; padding: 9px 0;
  font-size: 14px; font-weight: 600; cursor: pointer; }

/* Used-state must match existing interactive behaviour: dimmed but still
   tappable, so a customer can scroll back and re-pick. */
.pc-interactive-used .pc-chip,
.pc-interactive-used .pc-card-btn,
.pc-interactive-used .pc-price-row,
.pc-interactive-used .pc-date,
.pc-interactive-used .pc-slot,
.pc-interactive-used .pc-confirm-btn { opacity: .65; }

/* =====================================================================
   MOCKUP THEME — docs/sultan-rich-chat-mockup.html, ported verbatim.
   Appended as an override layer rather than a rewrite so the base sheet
   (media, typing, composer plumbing) keeps working and this is one
   contiguous block to revert if it is not wanted.
   ===================================================================== */
:root {
  /* Brand blue, derived from --accent so a client's configured accent_color
     drives the whole chat rather than only a few controls. The palette here
     was forest green and hardcoded, which meant a client could set an accent
     and still get a green header, send button and selection ticks. */
  --accent-deep: #1D4ED8;
  --gold: #B8893B; --gold-deep: #8A6329;
  --paper: #F1EFE7; --card: #FFFFFF; --ink: #16211D;
  --muted: #6B7670; --hair: #E4DFD2; --chip: #E7EEFD;
  --font: 'Inter', system-ui, -apple-system, sans-serif;
}
html, body { background: var(--paper); color: var(--ink);
  font-family: var(--font); -webkit-font-smoothing: antialiased; }
/* Mockup .chat — 10px between blocks, 14px/12px inset. A rich component is a
   sibling of the bubbles now, so this gap is what separates a card from the
   line above it.
   overflow-x:hidden is a backstop, not the fix: the chat column itself must
   never scroll sideways. Anything genuinely wider than the column (the
   carousel, the date strip) carries its own overflow-x:auto and scrolls
   in place. */
.pc-messages { gap: 10px; padding: 14px 12px 8px; overflow-x: hidden; }
/* Nothing may widen the page. overflow-x only — NOT max-width: this rule sits
   after the responsive block, so setting max-width here would override the
   480px/420px desktop frame and stretch the chat across the whole screen. */
html, body { overflow-x: hidden; }

/* ---------- header ---------- */
.pc-header {
  /* Lighter than the old forest gradient, and mixed from --accent so it
     follows the client's colour. The flat first declaration is the fallback
     for engines without color-mix. */
  background: var(--accent);
  background: linear-gradient(160deg,
    color-mix(in srgb, var(--accent) 78%, #ffffff) 0%,
    var(--accent) 100%);
  color: #fff;
}
.pc-header-name, .pc-title {
  font-family: 'Fraunces', serif; font-weight: 600;
  font-size: 17px; letter-spacing: .01em;
}
.pc-header-status, .pc-subtitle { font-size: 11.5px; color: #CFE3D6; }

/* ---------- bubbles ---------- */
.pc-bubble {
  max-width: 82%; border-radius: 16px; padding: 10px 13px;
  font-size: 14px; line-height: 1.5;
}
.pc-bubble-assistant {
  background: var(--card); color: var(--ink);
  border: none; border-bottom-left-radius: 5px;
  box-shadow: 0 1px 2px rgba(20,40,30,.07);
}
.pc-bubble-user {
  background: #DCEFE2; color: var(--ink); border-bottom-right-radius: 5px;
}
.pc-time { font-size: 9.5px; color: #9AA39C; margin-top: 4px; }

/* ---------- chips ---------- */
.pc-chips { display: flex; flex-wrap: wrap; gap: 7px; max-width: 92%; }
.pc-chip, .pc-interactive-btn {
  background: var(--chip); border: 1px solid #C9D9F8; color: var(--accent-deep);
  font-size: 12.5px; font-weight: 600; border-radius: 99px;
  padding: 7px 14px; cursor: pointer; transition: background .15s;
}
.pc-chip:active, .pc-interactive-btn:active { background: #D6E6DA; }

/* ---------- carousel ---------- */
.pc-carousel {
  display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory;
  padding: 2px 2px 6px; scrollbar-width: none;
}
.pc-carousel::-webkit-scrollbar { display: none; }
.pc-card {
  flex: 0 0 210px; scroll-snap-align: start; background: var(--card);
  border-radius: 18px; overflow: hidden; border: none;
  box-shadow: 0 4px 14px -8px rgba(20,40,30,.25);
  display: flex; flex-direction: column;
}
/* Mockup .tphoto — the badge overlays the photo, bottom-left. The gradient
   shows through for a card that has a badge but no image. */
.pc-card-photo {
  height: 120px; position: relative; display: flex; align-items: flex-end;
  padding: 9px 11px; background: linear-gradient(150deg,
    color-mix(in srgb, var(--accent) 72%, #ffffff),
    var(--accent-deep));
}
.pc-card-photo::after {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(120% 90% at 80% 0%, rgba(255,255,255,.22), transparent 55%);
}
.pc-card-img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; display: block;
}
/* .tbody + .trow from the mockup */
.pc-card-body {
  padding: 11px 13px 13px; display: flex; flex-direction: column; gap: 4px;
}
.pc-card-row {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 6px; gap: 8px;
}
.pc-card-title {
  font-family: 'Fraunces', serif; font-weight: 600; font-size: 15.5px;
}
.pc-card-sub { font-size: 11.5px; color: var(--muted); }
.pc-card-price {
  font-family: 'IBM Plex Mono', monospace; font-weight: 600;
  font-size: 14px; color: var(--gold-deep);
}
.pc-card-btn {
  background: var(--accent); color: #fff; border: none; flex: none;
  font-family: var(--font); font-size: 12px; font-weight: 600;
  border-radius: 99px; padding: 7px 16px; cursor: pointer;
}
/* .pcard from the mockup - header + rows inside one rounded card */
.pc-pricecard {
  background: var(--card); border-radius: 18px; border-bottom-left-radius: 6px;
  overflow: hidden; box-shadow: 0 3px 12px -8px rgba(20,40,30,.25);
}
.pc-pricecard .pc-interactive-list-header { border-bottom: 1px solid var(--hair); }
.pc-card-btn:active { background: var(--accent-deep); }
/* Mockup .tphoto span — small uppercase label on the photo, not a pill.
   z-index keeps it legible over a real photograph; the mockup's flat
   gradients did not need it. */
.pc-card-badge {
  position: relative; z-index: 2; background: none; padding: 0;
  border-radius: 0; color: #fff; font-size: 10px; font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase; opacity: .85;
  text-shadow: 0 1px 3px rgba(0,0,0,.45);
}

/* ---------- gallery ---------- */
.pc-gallery {
  display: grid; grid-template-columns: 1fr 1fr; gap: 5px; max-width: 82%;
  border-radius: 16px; overflow: hidden;
}
.pc-gallery-cell { position: relative; height: 96px; overflow: hidden; }
.pc-gallery-cell img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pc-gallery-cell::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 40%, rgba(0,0,0,.35));
}
.pc-gallery-more {
  position: absolute; inset: 0; display: flex; align-items: center;
  justify-content: center; background: rgba(15,58,44,.72); color: #fff;
  font-size: 15px; font-weight: 700; z-index: 2;
  border: none; cursor: pointer; font-family: var(--font);
}

/* ---------- price list ---------- */
/* Base heading carries the mockup's serif weight only. The padding and
   hairline belong to the price card specifically (.pcard .ph) — applying them
   everywhere put a stray rule under any other component's title. */
.pc-interactive-list-header {
  font-family: 'Fraunces', serif; font-weight: 600; font-size: 15px;
  margin-bottom: 6px;
}
.pc-pricecard .pc-interactive-list-header {
  padding: 12px 15px 10px; margin-bottom: 0;
  border-bottom: 1px solid var(--hair);
}
/* Mockup .confirm h4 (the .bwid h4 rule lives in the booking section below) */
.pc-confirm-title {
  font-family: 'Fraunces', serif; font-weight: 600; font-size: 15.5px;
  margin-bottom: 9px;
}
.pc-price-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 11px 15px; border-bottom: 1px solid var(--hair);
  background: var(--card); cursor: pointer;
}
.pc-price-row:last-child { border-bottom: none; }
.pc-price-title { font-size: 13.5px; font-weight: 500; }
.pc-price-desc { font-size: 11px; color: var(--muted); font-weight: 400; margin-top: 1px; }
.pc-price-amount {
  font-family: 'IBM Plex Mono', monospace; font-size: 13px; font-weight: 600;
  color: var(--gold-deep); white-space: nowrap;
}

/* ---------- booking widget ---------- */
.pc-dates { display: flex; gap: 7px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.pc-dates::-webkit-scrollbar { display: none; }
/* Booking widget card - the mockup's .bwid */
.pc-booking {
  background: var(--card); border-radius: 18px; border-bottom-left-radius: 6px;
  padding: 13px 15px 15px; box-shadow: 0 3px 12px -8px rgba(20,40,30,.25);
}
.pc-booking-title {
  font-family: 'Fraunces', serif; font-weight: 600; font-size: 15px;
  margin-bottom: 10px;
}
.pc-date {
  flex: none; border: 1.5px solid var(--hair); border-radius: 12px;
  padding: 7px 13px; text-align: center; cursor: pointer;
  background: var(--card); transition: all .15s;
}
.pc-date b { display: block; font-size: 14px; font-weight: 700; }
.pc-date span {
  display: block; font-size: 10px; color: var(--muted);
  letter-spacing: .05em; text-transform: uppercase;
}
.pc-date.pc-sel { background: var(--accent); border-color: var(--accent); }
.pc-date.pc-sel b, .pc-date.pc-sel span { color: #fff; }
.pc-slot.pc-full {
  color: #C2BFB4; text-decoration: line-through; cursor: default;
}
/* The base sheet still carries a :hover rule for slots from the old theme,
   and :hover fires on disabled buttons — without this a taken slot lit up
   as if it were selectable. */
.pc-slot.pc-full:hover {
  border-color: var(--hair); color: #C2BFB4; background: var(--card);
}
.pc-slots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin-top: 11px; }
.pc-slot {
  border: 1.5px solid var(--hair); border-radius: 10px; padding: 8px 0;
  text-align: center; background: var(--card);
  font-family: 'IBM Plex Mono', monospace; font-size: 12.5px; font-weight: 600;
  cursor: pointer; transition: all .15s;
}
.pc-slot.pc-sel { background: var(--gold); border-color: var(--gold); color: #fff; }

/* ---------- confirm ---------- */
.pc-confirm {
  background: linear-gradient(165deg, #FFFFFF, #FBF7EE);
  border: 1px solid #EADFC8; border-radius: 18px; border-bottom-left-radius: 6px;
  padding: 15px 16px; box-shadow: 0 4px 16px -10px rgba(120,90,30,.35);
}
.pc-confirm-row {
  display: flex; justify-content: space-between; gap: 16px;
  font-size: 13px; padding: 6px 0; border-bottom: 1px dashed #EAE2D0;
}
.pc-confirm-row:last-of-type { border-bottom: none; }
.pc-confirm-key { color: var(--muted); }
/* min-width:0 is load-bearing: .pc-confirm-row is a flex container, and a flex
   item defaults to min-width:auto, which REFUSES to shrink below its content.
   A payment URL or a long VA number therefore pushed the row wider than the
   card and spilled out of it. `anywhere` rather than `break-word` because only
   `anywhere` also lowers the min-content width, which is what lets the flex
   item shrink in the first place. */
.pc-confirm-val {
  font-weight: 600; text-align: right;
  min-width: 0; overflow-wrap: anywhere;
}
.pc-confirm-btn {
  width: 100%; margin-top: 12px; background: var(--gold); color: #fff;
  border: none; font-family: var(--font); font-size: 14px; font-weight: 700;
  letter-spacing: .02em; border-radius: 13px; padding: 13px 0; cursor: pointer;
}
.pc-confirm-btn:active { background: var(--gold-deep); }

/* ---------- rich blocks: siblings of the bubble, not children ----------
   The mockup drops each component straight into the chat column (.rich,
   .grid4, .pcard, .bwid, .confirm are all siblings of .msg). Nesting them in
   a bubble is what made them look cramped: the bubble caps width at 82% and
   adds its own padding, border and rounded background, so a card rendered
   inside a card and the photos shrank. Each component carries its own width
   here, taken from the mockup. */
/* BLOCK, not flex. .pc-interactive sets display:flex/column, and in a column
   flex container align-items governs the HORIZONTAL axis — so the components
   inside were shrink-to-fit rather than filling the column. A wide carousel or
   date strip then sized to its own content, overflowed the phone frame and put
   a horizontal scrollbar on the page. As blocks they fill the column, the
   max-width rules below cap them, and overflow-x:auto scrolls INSIDE the
   carousel where it belongs. The mockup has no wrapper here at all. */
.pc-rich {
  display: block; align-self: flex-start;
  width: 100%; max-width: 100%; min-width: 0; margin-top: 0;
}
.pc-rich-carousel { width: 100%; }
/* A flex/grid child will not shrink below its content without this, which is
   what lets an inner scroller actually scroll instead of pushing the page. */
.pc-rich > * { min-width: 0; max-width: 100%; }
.pc-rich-chips .pc-chips { max-width: 92%; }
.pc-rich-gallery .pc-gallery { max-width: 82%; }
.pc-rich-pricelist .pc-pricecard { max-width: 88%; }
.pc-rich-datepicker .pc-booking { max-width: 92%; }
.pc-rich-confirm .pc-confirm { max-width: 92%; }
/* The carousel scrolls the full column width; the hint sits under it. */
.pc-rich-carousel .pc-carousel { width: 100%; }
.pc-carousel-hint { font-size: 10.5px; color: #9AA39C; margin-top: 5px; padding-left: 4px; }

/* ---------- checklist tick (mockup .tick) ---------- */
.pc-price-row { width: 100%; text-align: left; }
.pc-price-left { flex: 1; min-width: 0; }
.pc-tick {
  width: 19px; height: 19px; border-radius: 50%; border: 2px solid #CBD6CE;
  flex: none; margin-left: 2px; display: flex; align-items: center;
  justify-content: center; transition: all .15s;
}
.pc-price-row.pc-sel { background: #F4F8F4; }
.pc-price-row.pc-sel .pc-tick { background: var(--accent); border-color: var(--accent); }
.pc-price-row.pc-sel .pc-tick::after {
  content: '✓'; color: #fff; font-size: 11px; font-weight: 700;
}
/* A chosen option stays at full strength while the rest of the set dims, so
   the customer can still see what they picked. */
.pc-interactive-used .pc-sel { opacity: 1; }

/* ---------- composer ---------- */
.pc-composer { background: var(--paper); border-top: 1px solid var(--hair); }
.pc-input {
  background: #fff; border: 1px solid var(--hair); border-radius: 99px;
  padding: 11px 17px; font-size: 13.5px; font-family: var(--font);
}
.pc-send { background: var(--accent); color: #fff; }

/* ===== LINKS + COPY ===== */
.pc-link {
  color: inherit; text-decoration: underline;
  text-underline-offset: 2px; overflow-wrap: anywhere;
}
.pc-bubble-user .pc-link { color: #fff; }
.pc-copyable { font-variant-numeric: tabular-nums; }
/* Sits inline after the value it copies. Deliberately NOT absolutely
   positioned: inside .pc-confirm-val the value already wraps, so an overlay
   would land on top of the wrapped text. */
.pc-copy {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; margin-left: 5px; padding: 0;
  vertical-align: -4px; cursor: pointer;
  border: 1px solid var(--hair, #e5e7eb); border-radius: 6px;
  background: rgba(255, 255, 255, .75); color: inherit;
  font-size: 12px; line-height: 1; opacity: .65;
  transition: opacity .12s ease, background .12s ease;
}
.pc-copy:hover, .pc-copy:focus-visible { opacity: 1; background: #fff; }
.pc-copy.pc-copied {
  opacity: 1; border-color: #16a34a; color: #16a34a; font-size: 0;
}
.pc-copy.pc-copied::after { content: "✓"; font-size: 12px; }
/* A second or third action stacks under the first rather than squeezing
   beside it — the titles are sentences ("Punya voucher"), not icons. */
.pc-confirm-btn + .pc-confirm-btn { margin-top: 8px; }

/* ===== LONG UNBROKEN TEXT MUST NEVER WIDEN A CARD =====
   A payment link (checkout.xendit.co/web/<32 hex>) or a bare VA number is one
   unbreakable "word". Any of these that sits in a flex row would otherwise
   force its container past the chat width and spill outside the card.

   :where() so this carries ZERO specificity — every rule above still wins on
   the properties it sets, and this only fills in what none of them set.
   Elements that deliberately stay on one line (.pc-card-price and friends use
   white-space: nowrap) are unaffected: nowrap suppresses wrapping outright, so
   overflow-wrap has nothing to act on. */
:where(.pc-bubble-text, .pc-card-title, .pc-card-sub, .pc-card-body,
       .pc-confirm-title, .pc-confirm-key, .pc-booking-title, .pc-price-desc,
       .pc-price-title, .pc-rich p, .pc-rich span, .pc-rich div, .pc-rich a) {
  /* Wrapping ONLY. Deliberately no min-width:0 here: .pc-price-amount is a
     nowrap flex item, and letting it shrink below its content would squeeze
     the price instead of the label beside it. The two places that genuinely
     need to shrink (.pc-bubble, .pc-confirm-val) set min-width:0 themselves. */
  overflow-wrap: anywhere;
}
/* =====================================================================
   MOCKUP v2 THEME — docs/sultan-rich-chat-mockup-v2.html
   Terracotta surfaces + glass. One contiguous block, last in the file, so it
   can be reverted by deletion alone.

   --accent is NOT hardcoded here. It stays the client's configured colour and
   still drives the send button, selections and ticks, so a client with their
   own accent_color keeps it; only the SURFACES (background, header, bubbles)
   come from the mockup. Hardcoding the palette would have undone per-client
   theming, which is the thing this file spent the last change fixing.
   ===================================================================== */
:root {
  --terra: #A5674E; --terra-deep: #7E4A34; --clay: #C48A62;
  --cream: #F3ECE1; --cream-2: #E9DDCC; --sand: #EFE6D9;
  --cocoa: #3B2A22; --ink: #2C1E17; --muted: #8C7B6E;
  --gold: #C79A5B; --gold-deep: #9E7638;
  --hair: rgba(120, 88, 66, .14);
  --glass: rgba(255, 252, 247, .72);
  --glass-2: rgba(255, 252, 247, .55);
  --shadow: 0 10px 30px -14px rgba(80, 50, 32, .45);
}
html, body {
  color: var(--ink);
  background:
    radial-gradient(120% 80% at 15% -5%, #F6EFE4 0%, transparent 55%),
    radial-gradient(120% 90% at 95% 5%, #E7CDB9 0%, transparent 45%),
    radial-gradient(140% 120% at 50% 110%, #D9BFA8 0%, transparent 50%),
    linear-gradient(160deg, #F1E7DA 0%, #E4CDB8 100%);
  background-attachment: fixed;
}

/* ---------- header ---------- */
.pc-header {
  background: var(--glass);
  -webkit-backdrop-filter: blur(22px) saturate(160%);
  backdrop-filter: blur(22px) saturate(160%);
  border-bottom: 1px solid var(--hair);
  color: var(--cocoa);
  padding: 12px 16px;
  padding-top: calc(env(safe-area-inset-top) + 12px);
}
/* The warm hairline under the header in the mockup. */
.pc-header::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--terra), var(--gold), transparent);
  opacity: .5;
}
.pc-header-logo {
  width: 44px; height: 44px; background: var(--terra);
  box-shadow: 0 4px 12px -4px rgba(126, 74, 52, .6),
              inset 0 0 0 2px rgba(255, 255, 255, .5);
}
.pc-header-who { line-height: 1.25; flex: 1; min-width: 0; }
.pc-header-name {
  display: block; color: var(--cocoa);
  font-family: 'Fraunces', serif; font-weight: 600; font-size: 18px;
}
.pc-header-status {
  display: flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 500; color: var(--muted);
}
.pc-dot {
  width: 7px; height: 7px; border-radius: 50%; background: #5FB98A;
  box-shadow: 0 0 0 3px rgba(95, 185, 138, .22);
}

/* ---------- chat surface ---------- */
.pc-messages { padding: 16px 13px 8px; gap: 11px; }
.pc-bubble { max-width: 80%; border-radius: 20px; padding: 11px 14px;
             font-size: 14.5px; line-height: 1.5; }
.pc-bubble-assistant {
  background: rgba(255, 255, 255, .72);
  -webkit-backdrop-filter: blur(14px) saturate(150%);
  backdrop-filter: blur(14px) saturate(150%);
  border: 1px solid rgba(255, 255, 255, .7);
  border-bottom-left-radius: 6px; color: var(--ink);
  box-shadow: 0 6px 18px -12px rgba(80, 50, 32, .4);
}
.pc-bubble-user {
  background: linear-gradient(160deg, var(--clay), var(--terra));
  color: #fff; border: none; border-bottom-right-radius: 6px;
  box-shadow: 0 8px 20px -12px rgba(126, 74, 52, .8);
}
.pc-bubble-user .pc-link { color: #fff; }
.pc-consent, .pc-note {
  align-self: center; max-width: 72%; text-align: center;
  font-size: 10px; line-height: 1.5; color: var(--muted);
}

/* ---------- day separator ---------- */
.pc-daypill {
  align-self: center; margin: 2px 0 4px; padding: 4px 13px;
  font-size: 10.5px; font-weight: 600; letter-spacing: .08em;
  color: var(--muted); background: var(--glass-2);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border: 1px solid var(--hair); border-radius: 99px;
}

/* ---------- composer ---------- */
.pc-composer {
  background: var(--glass);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  backdrop-filter: blur(24px) saturate(160%);
  border-top: 1px solid var(--hair);
  display: flex; flex-direction: column; gap: 8px;
}
.pc-powered {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  font-size: 9.5px; font-weight: 600; letter-spacing: .08em;
  text-transform: uppercase; color: var(--muted); opacity: .5;
}
.pc-input {
  background: rgba(255, 255, 255, .7); border: 1px solid var(--hair);
  border-radius: 99px; padding: 12px 18px; color: var(--ink);
}
.pc-input::placeholder { color: #A9998B; }
.pc-icon-btn { color: #8C7B6E; }
.pc-icon-btn:hover { color: var(--terra-deep); }

/* ---------- input row (mockup v2) ---------- */
.pc-composer-inner { gap: 9px; }
.pc-fieldwrap {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 1px;
  background: rgba(255, 255, 255, .7); border: 1px solid var(--hair);
  border-radius: 99px; padding: 0 6px;
}
/* The pill is the wrapper now, so the input itself goes flat inside it. */
.pc-fieldwrap .pc-input {
  flex: 1; background: transparent; border: none; border-radius: 0;
  padding: 11px 6px; box-shadow: none;
}
.pc-fieldwrap .pc-input:focus { box-shadow: none; }
.pc-fieldwrap:focus-within { border-color: var(--clay); }
.pc-fieldwrap .pc-icon-btn { width: 34px; height: 34px; }

/* ---------- date + time picker (mockup v2 .bwid) ---------- */
.pc-booking {
  align-self: flex-start; max-width: 92%; padding: 15px 16px 17px;
  border-radius: 22px; background: rgba(255, 255, 255, .7);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, .65); box-shadow: var(--shadow);
}
.pc-booking-title {
  font-family: 'Fraunces', serif; font-weight: 600; font-size: 15.5px;
  margin-bottom: 11px; color: var(--cocoa);
}
.pc-dates { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 5px;
            scrollbar-width: none; }
.pc-dates::-webkit-scrollbar { display: none; }
.pc-date {
  flex: none; min-width: 52px; padding: 8px 6px; text-align: center;
  border: 1.5px solid var(--hair); border-radius: 14px; cursor: pointer;
  background: rgba(255, 255, 255, .5); transition: all .15s;
}
.pc-date b { display: block; font-size: 16px; font-weight: 700; color: var(--ink); }
.pc-date span { font-size: 10px; font-weight: 600; color: var(--muted);
                letter-spacing: .05em; text-transform: uppercase; }
.pc-date.pc-sel {
  background: linear-gradient(150deg, var(--terra), var(--terra-deep));
  border-color: transparent; box-shadow: 0 8px 16px -8px rgba(126, 74, 52, .6);
}
.pc-date.pc-sel b, .pc-date.pc-sel span { color: #fff; }
.pc-more {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 3px; background: transparent;
  border-style: dashed; border-color: rgba(165, 103, 78, .4);
}
.pc-more span { color: var(--terra-deep); letter-spacing: .03em; }
.pc-calico { font-size: 16px; line-height: 1; }
.pc-cal { margin-top: 12px; border-top: 1px solid var(--hair); padding-top: 12px; }
.pc-cal[hidden] { display: none; }
.pc-cal-h { font-family: 'Fraunces', serif; font-weight: 600; font-size: 14px;
            color: var(--cocoa); text-align: center; margin-bottom: 9px; }
.pc-cal-dows { display: grid; grid-template-columns: repeat(7, 1fr);
               gap: 4px; margin-bottom: 5px; }
.pc-cal-dows span { text-align: center; font-size: 9.5px; font-weight: 600;
                    color: var(--muted); text-transform: uppercase; }
.pc-cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.pc-cday {
  aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
  font-size: 12.5px; font-weight: 600; color: var(--ink); border-radius: 10px;
  background: rgba(255, 255, 255, .5); border: 1px solid var(--hair);
  cursor: pointer; transition: all .15s;
}
.pc-cday-empty { background: transparent; border: none; cursor: default; }
/* A day the bot did not offer. Dimmed and inert — it carries no tap
   attributes, so it cannot raise a choice the calendar may not honour. */
.pc-cday-off { color: #C9BDB0; background: transparent;
               border-color: transparent; cursor: default; }
.pc-cday.pc-sel {
  background: linear-gradient(150deg, var(--terra), var(--terra-deep));
  border-color: transparent; color: #fff;
}
.pc-slots { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
            gap: 8px; margin-top: 13px; }
.pc-slot {
  padding: 9px 0; text-align: center; border: 1.5px solid var(--hair);
  border-radius: 12px; background: rgba(255, 255, 255, .5); cursor: pointer;
  font-family: 'IBM Plex Mono', monospace; font-size: 13px; font-weight: 600;
  color: var(--ink); transition: all .15s;
}
.pc-slot.pc-full { color: #C9BDB0; text-decoration: line-through;
                   background: transparent; cursor: default; }
.pc-slot.pc-sel {
  background: linear-gradient(150deg, var(--gold), var(--gold-deep));
  border-color: transparent; color: #fff;
  box-shadow: 0 8px 16px -8px rgba(158, 118, 56, .6);
}
/* ---------- confirm card (mockup v2 .confirm) ---------- */
.pc-confirm {
  background: linear-gradient(165deg, rgba(255,251,244,.82), rgba(244,228,205,.7));
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  backdrop-filter: blur(18px) saturate(150%);
  border: 1px solid rgba(199, 154, 91, .4); border-radius: 22px;
  box-shadow: 0 14px 34px -16px rgba(158, 118, 56, .5);
}
.pc-confirm-title { font-family: 'Fraunces', serif; font-weight: 600;
                    font-size: 16px; color: var(--cocoa); }
.pc-confirm-row { border-bottom: 1px dashed rgba(158, 118, 56, .28); }

/* ---------- carousel + photos, sized to mockup v2 ---------- */
.pc-carousel { gap: 12px; }
.pc-card { flex: 0 0 232px; border-radius: 22px; }
.pc-card-photo { height: 150px; }
/* Two-stop scrim, per v2: darkens the TOP so a badge stays legible and the
   BOTTOM so the title does. A single highlight left text over a pale photo
   with nothing behind it. */
.pc-card-photo::after {
  background: linear-gradient(180deg, rgba(40, 22, 14, .30) 0%,
              transparent 34%, transparent 60%, rgba(40, 22, 14, .42) 100%);
}

/* ---------- photo grid (mockup v2 .grid) ---------- */
.pc-gallery {
  width: 88%; max-width: 88%; gap: 6px; border-radius: 22px;
  overflow: hidden; box-shadow: var(--shadow);
  /* v2 fixes 270px at a 430px frame. Expressed as a ratio instead so the
     small tiles keep their proportions on a narrower phone, where a hard
     height would squash them. */
  aspect-ratio: 1.4; height: auto;
  display: grid; grid-template-columns: 2fr 1fr 1fr; grid-template-rows: 1fr 1fr;
}
.pc-gallery-cell { height: auto; min-height: 0; }
/* The hero: first tile spans both rows. */
.pc-g-4 .pc-gallery-cell:first-child { grid-row: 1 / span 2; }
/* Fewer than four photos never hits v2's template, so each count gets a shape
   that fills the box rather than leaving a hole. */
.pc-g-1 { grid-template-columns: 1fr; grid-template-rows: 1fr; aspect-ratio: 1.6; }
.pc-g-2 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr; aspect-ratio: 2; }
.pc-g-3 { grid-template-columns: 2fr 1fr; grid-template-rows: 1fr 1fr; }
.pc-g-3 .pc-gallery-cell:first-child { grid-row: 1 / span 2; }
/* Expanded: back to a uniform grid, which scrolls naturally for any count. */
.pc-g-all {
  grid-template-columns: 1fr 1fr; grid-template-rows: none;
  aspect-ratio: auto;
}
.pc-g-all .pc-gallery-cell { height: 96px; }
.pc-gallery-more {
  background: rgba(45, 25, 16, .5); font-family: 'Fraunces', serif;
  font-weight: 600; font-size: 17px;
}

/* A bubble held by the typing-buffer: sent by the customer, not yet dispatched.
   Without this the bubble looks identical to a delivered one and the buffer
   window reads as the app having frozen. */

/* The just-recorded bubble uses a NATIVE <audio controls> (addMediaBub), not
   the custom player the server-rendered copy gets. Native controls carry an
   intrinsic width near 300px and do not shrink, so on a phone the player
   pushed straight out of the bubble and off the screen.

   The width MUST be a definite length, never a percentage. `.pc-messages` is a
   column flex and `.pc-bubble-user` sets `align-self: flex-end`, so the bubble
   is shrink-to-fit: its width comes from its children. A child asking for
   `width: 100%` of a parent whose width is defined by that child is circular,
   and the browser resolves it to ZERO — the player was present and
   `display:block` but measured 0x40, which on screen is an empty bubble.
   (Reported as "audio bar can't be seen"; the debug probe measured it.)

   HEIGHT is deliberately left alone: a native control has an intrinsic minimum
   (~54px on iOS) and forcing it below that clips the controls away. Cap the
   width against the VIEWPORT, which is never circular. */
.pc-bubble audio {
  display: block; width: 240px; max-width: 62vw;
  height: auto; min-height: 40px; margin: 2px 0;
}
/* The local image preview needs the same treatment for the same reason. */
.pc-media-thumb {
  display: block; width: 100%; max-width: 220px; height: auto;
  border-radius: 12px;
}
/* The server-rendered copy uses the CUSTOM player (play button + progress bar)
   and lives in the same shrink-to-fit bubble, so it needs the same treatment:
   a definite width, capped against the viewport rather than the parent. The
   earlier `min-width: 0; max-width: 100%` left it free to collapse for exactly
   the circular reason described above. */
.pc-media-audio { width: 240px; max-width: 62vw; min-width: 0; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* Undelivered outbound message (BUGS #17).
 *
 * The bubble is drawn the moment the customer hits send and the input is
 * cleared straight away, so a send that never reached the server used to be
 * indistinguishable from a delivered one. They found out on reload, when the
 * message was gone. This says so at the point of failure instead. */
.pc-bubble-failed {
  opacity: .72;
  border: 1px dashed var(--pc-danger, #c53030);
}

.pc-send-failed-note {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .2px;
  color: var(--pc-danger, #c53030);
}

/* ===== QUOTED REPLY (sheet #1) =====
   The panel inside a bubble, the reply affordance, and the pill above the
   composer. The bubble itself gains `position: relative` and a transition so
   the swipe has something to move and something to spring back to. */
.pc-bubble { position: relative; transition: transform 0.18s ease-out; }
.pc-bubble.pc-swiping { transition: none; }

.pc-quote {
  display: block; margin: 0 0 6px; padding: 5px 9px;
  border-left: 3px solid currentColor;
  border-radius: 6px;
  font-size: 0.8rem; line-height: 1.35;
  /* Tinted from the bubble's own text colour, so it reads correctly on the
     accent-coloured customer bubble AND on the light assistant one without
     hard-coding either palette. */
  background: rgba(127, 127, 127, 0.16);
  opacity: 0.9;
}
.pc-quote-who {
  display: block; font-weight: 600; font-size: 0.72rem;
  opacity: 0.85; margin-bottom: 1px;
}
.pc-quote-text {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Desktop affordance. Half the web-chat traffic cannot swipe at all, so the
   gesture alone would hide the feature from those customers entirely. */
.pc-quote-btn {
  position: absolute; top: 2px;
  background: none; border: 0; cursor: pointer;
  font-size: 0.9rem; line-height: 1; padding: 4px 6px;
  color: inherit; transition: opacity 0.12s ease-out;
  /* Faintly visible at rest, not opacity:0. A control that only appears on
     hover is a control nobody finds -- reported as "I can't slide any chat"
     from a desktop, where sliding is not possible at all and this button IS
     the feature. */
  opacity: 0.3;
}
.pc-bubble-user .pc-quote-btn { left: -26px; }
.pc-bubble-assistant .pc-quote-btn { right: -26px; }
.pc-bubble:hover .pc-quote-btn { opacity: 0.8; }
.pc-quote-btn:hover { opacity: 1; }
.pc-quote-btn:focus-visible { opacity: 1; outline: 2px solid var(--accent); }
/* No hover on a touch screen, and the button would sit under the thumb during
   a swipe. There the gesture IS the affordance. */
@media (hover: none) { .pc-quote-btn { display: none; } }

.pc-quotebar {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 12px; margin: 0;
  background: rgba(127, 127, 127, 0.1);
  border-top: 1px solid rgba(127, 127, 127, 0.18);
  font-size: 0.8rem;
}
.pc-quotebar-body {
  flex: 1; min-width: 0;
  border-left: 3px solid var(--accent); padding-left: 8px;
}
.pc-quotebar .pc-quote-text { -webkit-line-clamp: 1; }
.pc-quotebar-x {
  background: none; border: 0; cursor: pointer;
  font-size: 1.15rem; line-height: 1; padding: 2px 6px; opacity: 0.6;
}
.pc-quotebar-x:hover { opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  .pc-bubble { transition: none; }
}
