.demo { overflow-anchor: none; }
.demo-body { gap: 12px; height: 650px; min-height: 650px; }
.demo-case-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.demo-case-heading strong { font-size: 14px; font-weight: 500; }
.demo-case-heading span { color: rgba(255,255,255,.5); font-size: 11px; }
.chat-log { flex: 1 1 0; overscroll-behavior: contain; }
.chat-message { flex-shrink: 0; overflow-wrap: anywhere; }
.typing { flex-shrink: 0; }
.typing.client { align-self: flex-end; border-color: rgba(255,255,255,.8); border-radius: 14px 14px 5px 14px; background: #fff; }
.typing.client i { background: var(--muted); }
.chat-message.manager { align-self: flex-start; color: #e5fff9; border: 1px solid rgba(101,232,255,.25); border-radius: 15px 15px 15px 5px; background: rgba(101,232,255,.1); }
.receipt-attachment { width: min(100%, 224px); margin: 0 0 10px; overflow: hidden; border: 1px solid rgba(0,0,0,.1); border-radius: 12px; }
.receipt-preview { position: relative; display: flex; align-items: center; flex-direction: column; gap: 6px; padding: 22px 12px 16px; color: #fff; background: linear-gradient(155deg, #005347, #079947 65%, #128b27); }
.receipt-check { display: grid; width: 34px; height: 34px; margin-bottom: 8px; place-items: center; border-radius: 50%; color: #087c49; background: #fff; box-shadow: 0 0 0 6px rgba(255,255,255,.15), 0 0 0 12px rgba(255,255,255,.08); }
.receipt-check svg { width: 20px; height: 20px; }
.receipt-status { font-size: 11px; }
.receipt-amount { font-size: 26px; font-weight: 600; line-height: 1.15; }
.receipt-purpose { font-size: 9px; color: rgba(255,255,255,.85); }
.receipt-caption { display: flex; align-items: center; gap: 7px; padding: 10px; color: #fff; background: #161c19; }
.receipt-filetype { flex: 0 0 auto; padding: 3px; border: 1px solid #369a58; border-radius: 4px; color: #7fdb93; font-size: 8px; }
.receipt-filename { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 9px; }
.booking-attachment { margin-top: 12px; padding: 14px; border: 1px solid rgba(174,246,123,.3); border-radius: 12px; color: #f4fff0; background: linear-gradient(135deg, #233d32, #1c2d2b); }
.booking-status { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; color: #baf985; font-size: 10px; }
.booking-status svg { width: 15px; height: 15px; }
.booking-title { display: block; font-size: 16px; font-weight: 500; }
.booking-schedule { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 12px 0; }
.booking-schedule strong { font-size: 14px; font-weight: 500; }
.booking-label { display: block; margin-bottom: 2px; color: rgba(255,255,255,.55); font-size: 9px; }
.booking-place { margin: 0; font-size: 12px; line-height: 1.4; }
.booking-detail { margin: 10px 0 0; padding-top: 8px; border-top: 1px solid rgba(255,255,255,.13); color: rgba(255,255,255,.65); font-size: 10px; }
.case-result { display: flex; flex: 0 0 100px; flex-direction: column; justify-content: center; gap: 10px; padding: 16px; border: 1px dashed rgba(255,255,255,.14); border-radius: 16px; background: rgba(255,255,255,.025); }
.case-result[hidden] { display: none; }
.case-finished .chat-log { display: none; }
.case-finished .case-result { flex: 1 1 0; padding: 28px; gap: 18px; }
.case-result.is-complete { border: 1px solid rgba(200,255,84,.3); background: linear-gradient(125deg, rgba(200,255,84,.1), rgba(101,232,255,.04)); animation: chat-in .4s var(--ease-out) both; }
.case-result-label { color: rgba(255,255,255,.5); font-size: 9px; letter-spacing: .1em; text-transform: uppercase; }
.is-complete .case-result-label { color: var(--lime); }
.case-result-heading { display: flex; align-items: center; gap: 10px; }
.case-result-heading svg { flex: 0 0 22px; width: 22px; height: 22px; color: var(--lime); }
.case-result-heading strong { font: 500 19px/1.2 var(--font-display); letter-spacing: -.025em; }
.is-complete .case-result-heading { flex-direction: column; align-items: flex-start; gap: 18px; }
.is-complete .case-result-heading svg { width: 36px; height: 36px; flex-basis: 36px; }
.is-complete .case-result-heading strong { font-size: clamp(28px, 2.7vw, 38px); line-height: 1.1; }
.case-result-outcome { margin: 0; font-size: 17px; line-height: 1.35; color: var(--lime); }
.case-result-detail, .case-benefit { margin: 0; font-size: 11px; line-height: 1.5; color: rgba(255,255,255,.65); }
.case-benefit { color: #e4e8dc; }
.case-tags, .case-attendance { display: flex; flex-wrap: wrap; gap: 6px; }
.case-tags span { padding: 5px 8px; border-radius: 6px; background: rgba(255,255,255,.07); font-size: 10px; color: rgba(255,255,255,.8); }
.case-attendance span { display: grid; min-width: 36px; min-height: 30px; place-items: center; padding: 4px 10px; border-radius: 7px; font-size: 12px; }
.case-attendance .attended { color: #b8bdb3; background: rgba(255,255,255,.09); }
.case-attendance .remaining { color: #172000; background: var(--lime); }
.case-controls { display: none; }
.cases-ready .case-controls { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px; }
.case-choices { position: relative; display: flex; gap: 6px; min-width: 0; overflow-x: auto; padding: 4px; scrollbar-width: none; overscroll-behavior-x: contain; }
.case-choices::-webkit-scrollbar { display: none; }
.case-choice, .case-next { flex: 0 0 auto; white-space: nowrap; min-height: 32px; padding: 6px 10px; color: rgba(255,255,255,.65); border: 1px solid rgba(255,255,255,.12); border-radius: 999px; background: transparent; font-size: 10px; cursor: pointer; }
.case-choice[aria-pressed="true"] { border-color: rgba(154,98,255,.65); background: rgba(154,98,255,.18); color: #fff; }
.case-next { color: #fff; background: rgba(255,255,255,.07); }
.case-next:hover, .case-choice:hover { border-color: rgba(154,98,255,.65); }
.case-controls button:focus-visible, .chat-log:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }
.demo-foot { line-height: 1.5; }
@keyframes chat-message-fade { from { opacity: 0; } to { opacity: 1; } }
@media (max-width: 620px) {
  .demo { display: flex; flex-direction: column; height: min(850px, var(--demo-available-height, calc(100svh - 32px))); }
  .demo-head, .demo-foot, .demo-case-heading, .case-controls { flex-shrink: 0; }
  .demo-body { flex: 1; height: auto; min-height: 0; }
  /* Transforms change scrollable overflow and make bottom-pinned messages jump. */
  .chat-message.visible { transform: none; animation: chat-message-fade .2s ease-out both; }
  .demo-case-heading { flex-wrap: wrap; gap: 4px 12px; }
  .case-result { padding: 13px; }
  .case-finished .case-result { min-height: 0; padding: 20px; gap: 14px; overflow-y: auto; overscroll-behavior: contain; justify-content: flex-start; }
  .case-result > * { flex-shrink: 0; }
  .case-result > :first-child { margin-top: auto; }
  .case-result > :last-child { margin-bottom: auto; }
  .case-result-heading strong { font-size: 18px; }
  .demo-foot { gap: 3px; }
}
@media (max-width: 620px) and (max-height: 700px) {
  .demo-head { padding: 12px 14px; }
  .demo-head small { font-size: 11px; }
  .demo-foot { padding: 8px 14px; font-size: 9px; }
  .case-finished .case-result { padding: 14px; gap: 10px; }
  .is-complete .case-result-heading { flex-direction: row; gap: 8px; }
  .is-complete .case-result-heading svg { flex: 0 0 24px; width: 24px; height: 24px; }
  .is-complete .case-result-heading strong { font-size: 24px; }
}
