/* chat-widget.css — "Toni" website chat (bubble + panel + reply cards). Every class starts with cw-.
 * Uses the page tokens when present, with fallbacks, so it also works on a bare page. */
.cw-root {
  --cw-accent: var(--sc-accent, #2152ff);
  --cw-ink: var(--sc-ink, #0a1020);
  --cw-ink-soft: var(--sc-ink-soft, #4b5670);
  --cw-surface: var(--sc-surface, #f3f6fd);
  --cw-canvas: #ffffff;
  --cw-line: rgba(10, 16, 32, .1);
  --cw-ok: #16a34a;
  --cw-font: var(--sc-font-text, "Geist", system-ui, -apple-system, "Segoe UI", sans-serif);
  --cw-font-display: var(--sc-font-display, "Bricolage Grotesque", "Geist", system-ui, sans-serif);
  --cw-gap: 24px;
  font-family: var(--cw-font);
  color: var(--cw-ink);
  -webkit-font-smoothing: antialiased;
}
.cw-root *, .cw-root *::before, .cw-root *::after { box-sizing: border-box; }

/* ---------- invitation above the bubble, sector chips, next-step card ---------- */
.cw-nudge {
  position: fixed; z-index: 89; display: flex; align-items: stretch; max-width: min(300px, calc(100vw - 2 * var(--cw-gap)));
  right: calc(var(--cw-gap) + env(safe-area-inset-right, 0px));
  bottom: calc(var(--cw-gap) + 60px + 12px + env(safe-area-inset-bottom, 0px));
  background: var(--cw-canvas); border-radius: 16px 16px 4px 16px;
  box-shadow: 0 14px 34px -10px rgba(10, 16, 32, .35), 0 0 0 1px var(--cw-line);
  animation: cwNudgeIn 380ms cubic-bezier(.2, .8, .2, 1) both;
}
.cw-nudge-text { padding: 12px 6px 12px 14px; border: 0; background: none; cursor: pointer; text-align: left;
  font: 500 14px/1.35 var(--cw-font); color: var(--cw-ink); }
.cw-nudge-x { display: grid; place-items: start center; padding: 8px 8px 0 4px; border: 0; background: none; cursor: pointer; color: var(--cw-ink-soft); }
.cw-nudge-x svg { width: 14px; height: 14px; }
.cw-nudge-text:focus-visible, .cw-nudge-x:focus-visible { outline: 2px solid var(--cw-accent); outline-offset: -2px; border-radius: 12px; }
@keyframes cwNudgeIn { from { opacity: 0; transform: translateY(8px) scale(.96); } to { opacity: 1; transform: none; } }
.cw-root.cw-is-open .cw-nudge { display: none; }
.cw-chip-sector { box-shadow: inset 0 0 0 1px var(--cw-accent); font-weight: 600; }
.cw-offer-row { display: flex; flex-wrap: wrap; gap: 8px; }
.cw-offer-row .cw-card-submit { flex: 1 1 auto; }
.cw-card-ghost {
  display: inline-flex; align-items: center; justify-content: center; min-height: 42px; padding: 10px 14px; border: 0; border-radius: 12px; cursor: pointer;
  font: 600 14px/1.2 var(--cw-font); color: var(--cw-accent); background: var(--cw-canvas); box-shadow: inset 0 0 0 1px rgba(33, 82, 255, .35);
  flex: 1 1 auto; transition: background 150ms, color 150ms;
}
.cw-card-ghost:not(:disabled):hover { background: var(--cw-accent); color: #fff; }
.cw-card-ghost:disabled { opacity: .5; cursor: default; }
.cw-card-done .cw-card-ghost, .cw-card-done .cw-offer-row .cw-card-submit { opacity: .5; cursor: default; }
@media (max-width: 480px) { .cw-nudge { bottom: calc(var(--cw-gap) + 56px + 12px + env(safe-area-inset-bottom, 0px)); } }
@media (prefers-reduced-motion: reduce) { .cw-nudge { animation: none; } }

/* ---------- bubble ---------- */
.cw-bubble {
  position: fixed; z-index: 90;
  right: calc(var(--cw-gap) + env(safe-area-inset-right, 0px));
  bottom: calc(var(--cw-gap) + env(safe-area-inset-bottom, 0px));
  width: 60px; height: 60px; padding: 0; border: 0; border-radius: 50%;
  display: grid; place-items: center; cursor: pointer;
  background: var(--cw-accent); color: #fff;
  box-shadow: 0 10px 30px -8px rgba(33, 82, 255, .55), 0 2px 6px rgba(10, 16, 32, .18);
  transition: transform 200ms cubic-bezier(.2, .8, .2, 1), box-shadow 200ms;
}
.cw-bubble:hover { transform: translateY(-2px) scale(1.03); box-shadow: 0 14px 34px -8px rgba(33, 82, 255, .6), 0 2px 6px rgba(10, 16, 32, .18); }
.cw-bubble:active { transform: scale(.96); }
.cw-bubble:focus-visible { outline: 3px solid var(--cw-ink); outline-offset: 3px; }
.cw-bubble svg { width: 26px; height: 26px; display: block; transition: transform 220ms, opacity 160ms; }
.cw-bubble .cw-ico-close { position: absolute; opacity: 0; transform: rotate(-45deg) scale(.6); }
.cw-root.cw-is-open .cw-bubble .cw-ico-mark { opacity: 0; transform: rotate(45deg) scale(.6); }
.cw-root.cw-is-open .cw-bubble .cw-ico-close { opacity: 1; transform: none; }

.cw-dot {
  position: absolute; top: 2px; right: 2px; width: 14px; height: 14px; border-radius: 50%;
  background: #ff3b5c; box-shadow: 0 0 0 2.5px #fff; transform: scale(0); transition: transform 220ms cubic-bezier(.2, .8, .2, 1);
}
.cw-root.cw-has-unread:not(.cw-is-open) .cw-dot { transform: scale(1); }

.cw-bubble.cw-pulse::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(33, 82, 255, .55);
  animation: cw-ring 1.2s cubic-bezier(.2, .8, .2, 1) 3;
}
@keyframes cw-ring { to { box-shadow: 0 0 0 18px rgba(33, 82, 255, 0); } }

/* ---------- panel ---------- */
.cw-panel {
  position: fixed; z-index: 91;
  right: calc(var(--cw-gap) + env(safe-area-inset-right, 0px));
  bottom: calc(var(--cw-gap) + 72px + env(safe-area-inset-bottom, 0px));
  width: 384px; height: min(640px, calc(100vh - 140px)); height: min(640px, calc(100dvh - 140px));
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--cw-canvas); border-radius: 20px;
  box-shadow: 0 0 0 1px var(--cw-line), 0 24px 60px -16px rgba(10, 16, 32, .35), 0 8px 18px -10px rgba(10, 16, 32, .2);
  transform-origin: bottom right;
  opacity: 0; transform: translateY(12px) scale(.98); visibility: hidden; pointer-events: none;
  transition: opacity 180ms ease, transform 220ms cubic-bezier(.2, .8, .2, 1), visibility 0s linear 220ms;
}
.cw-root.cw-is-open .cw-panel {
  opacity: 1; transform: none; visibility: visible; pointer-events: auto;
  transition: opacity 180ms ease, transform 220ms cubic-bezier(.2, .8, .2, 1), visibility 0s;
}

.cw-head {
  flex: none; display: flex; align-items: center; gap: 12px;
  padding: 16px 14px 16px 18px; background: var(--cw-accent); color: #fff;
}
.cw-avatar { flex: none; width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: rgba(255, 255, 255, .16); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .25); }
.cw-avatar svg { width: 18px; height: 18px; }
.cw-head-text { flex: 1; min-width: 0; }
.cw-title { margin: 0; font-family: var(--cw-font-display); font-weight: 600; font-size: 1.05rem; line-height: 1.2; letter-spacing: -0.01em; }
.cw-status { display: flex; align-items: center; gap: 6px; margin-top: 2px; font-size: 12.5px; color: rgba(255, 255, 255, .85); }
.cw-status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #4ade80; box-shadow: 0 0 0 3px rgba(74, 222, 128, .25); }
.cw-close {
  flex: none; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 10px; cursor: pointer;
  display: grid; place-items: center; background: transparent; color: #fff;
}
.cw-close:hover { background: rgba(255, 255, 255, .14); }
.cw-close:focus-visible { outline: 2px solid #fff; outline-offset: 1px; }
.cw-close svg { width: 20px; height: 20px; }

.cw-log {
  flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  display: flex; flex-direction: column; gap: 8px; padding: 18px 16px 8px;
  background: var(--cw-surface);
  scrollbar-width: thin;
}
.cw-msg {
  max-width: 84%; padding: 10px 13px; border-radius: 16px;
  font-size: 14.5px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere;
  animation: cw-in 220ms cubic-bezier(.2, .8, .2, 1);
}
.cw-msg a { color: inherit; text-decoration: underline; text-underline-offset: 2px; text-decoration-thickness: 1px; }
.cw-msg-bot { align-self: flex-start; background: var(--cw-canvas); color: var(--cw-ink); border-bottom-left-radius: 5px; box-shadow: 0 0 0 1px var(--cw-line); }
.cw-msg-bot a { color: var(--cw-accent); }
.cw-msg-user { align-self: flex-end; background: var(--cw-accent); color: #fff; border-bottom-right-radius: 5px; }
.cw-msg-note { align-self: center; max-width: 92%; padding: 6px 10px; font-size: 12px; color: var(--cw-ink-soft); background: transparent; text-align: center; }
@keyframes cw-in { from { opacity: 0; transform: translateY(6px); } }

.cw-typing { align-self: flex-start; display: inline-flex; gap: 4px; padding: 13px 14px; border-radius: 16px; border-bottom-left-radius: 5px; background: var(--cw-canvas); box-shadow: 0 0 0 1px var(--cw-line); }
.cw-typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--cw-ink-soft); opacity: .35; animation: cw-blink 1.1s infinite; }
.cw-typing i:nth-child(2) { animation-delay: .15s; }
.cw-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes cw-blink { 30% { opacity: 1; transform: translateY(-2px); } 60% { opacity: .35; transform: none; } }

.cw-chips { flex: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 16px 12px; background: var(--cw-surface); }
.cw-chips[hidden] { display: none; }
.cw-chip {
  padding: 7px 12px; border: 0; border-radius: 999px; cursor: pointer;
  font: 500 13px/1.2 var(--cw-font); color: var(--cw-accent); background: var(--cw-canvas);
  box-shadow: inset 0 0 0 1px rgba(33, 82, 255, .35);
  transition: background 150ms, color 150ms;
}
.cw-chip:hover { background: var(--cw-accent); color: #fff; }
.cw-chip:focus-visible { outline: 2px solid var(--cw-accent); outline-offset: 2px; }

.cw-form { flex: none; display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px 6px; background: var(--cw-canvas); border-top: 1px solid #e4e7ef; }
.cw-input {
  flex: 1; min-width: 0; max-height: 120px; resize: none; margin: 0; padding: 10px 12px;
  border: 0; border-radius: 12px; background: var(--cw-surface); color: var(--cw-ink);
  font: 15px/1.4 var(--cw-font);
}
.cw-input::placeholder { color: var(--cw-ink-soft); opacity: .8; }
.cw-input:focus { outline: none; box-shadow: inset 0 0 0 2px var(--cw-accent); }
.cw-send {
  flex: none; width: 42px; height: 42px; padding: 0; border: 0; border-radius: 12px; cursor: pointer;
  display: grid; place-items: center; background: var(--cw-accent); color: #fff; transition: opacity 150ms, transform 150ms;
}
.cw-send:disabled { opacity: .4; cursor: default; }
.cw-send:not(:disabled):active { transform: scale(.94); }
.cw-send:focus-visible { outline: 2px solid var(--cw-ink); outline-offset: 2px; }
.cw-send svg { width: 18px; height: 18px; }
.cw-foot { flex: none; padding: 2px 14px 10px; background: var(--cw-canvas); font-size: 11.5px; line-height: 1.4; color: var(--cw-ink-soft); text-align: center; }
.cw-foot a { color: inherit; text-underline-offset: 2px; }
.cw-count { color: #c2410c; }

/* ---------- cards under Toni's reply: slots, booking form, contact form, booked ---------- */
.cw-card {
  align-self: flex-start; width: 100%; max-width: 92%;
  background: var(--cw-canvas); border-radius: 16px; border-top-left-radius: 5px;
  box-shadow: 0 0 0 1px var(--cw-line);
  animation: cw-in 220ms cubic-bezier(.2, .8, .2, 1);
}
.cw-card-body { display: flex; flex-direction: column; gap: 10px; margin: 0; padding: 12px 13px 13px; }
.cw-card-title { display: flex; align-items: center; gap: 6px; margin: 0; font: 600 13.5px/1.3 var(--cw-font); color: var(--cw-ink); }
.cw-card-title svg { width: 18px; height: 18px; flex: none; color: var(--cw-ok); }
.cw-slots { display: flex; flex-direction: column; gap: 6px; }
.cw-slot {
  min-height: 44px; padding: 10px 14px; border: 0; border-radius: 12px; cursor: pointer; text-align: left;
  font: 500 14.5px/1.25 var(--cw-font); color: var(--cw-accent); background: var(--cw-canvas);
  box-shadow: inset 0 0 0 1px rgba(33, 82, 255, .35);
  transition: background 150ms, color 150ms, box-shadow 150ms;
}
.cw-slot:not(:disabled):hover { background: var(--cw-accent); color: #fff; }
.cw-slot:focus-visible, .cw-card-link:focus-visible, .cw-card-submit:focus-visible { outline: 2px solid var(--cw-accent); outline-offset: 2px; }
.cw-slot-picked { background: var(--cw-accent) !important; color: #fff !important; }
.cw-card-done .cw-slot:not(.cw-slot-picked) { opacity: .45; cursor: default; }
.cw-card-link {
  align-self: flex-start; padding: 2px 0; border: 0; background: none; cursor: pointer;
  font: 500 13px/1.3 var(--cw-font); color: var(--cw-ink-soft); text-decoration: underline; text-underline-offset: 2px;
}
.cw-card-link:disabled { cursor: default; opacity: .5; }
.cw-field { display: flex; flex-direction: column; gap: 4px; }
.cw-field-label { font-size: 12.5px; font-weight: 500; color: var(--cw-ink-soft); }
.cw-opt { font-weight: 400; opacity: .8; }
.cw-field-input {
  width: 100%; min-height: 40px; margin: 0; padding: 9px 11px; border: 0; border-radius: 10px;
  background: var(--cw-surface); color: var(--cw-ink); font: 14.5px/1.3 var(--cw-font);
}
.cw-field-input::placeholder { color: var(--cw-ink-soft); opacity: .7; }
.cw-field-input:focus { outline: none; box-shadow: inset 0 0 0 2px var(--cw-accent); }
.cw-field-input[aria-invalid="true"], .cw-consent input[aria-invalid="true"] { box-shadow: inset 0 0 0 2px #c2410c; outline-color: #c2410c; }
.cw-field-input:disabled { opacity: .6; }
.cw-consent { display: flex; align-items: flex-start; gap: 8px; font-size: 12.5px; line-height: 1.4; color: var(--cw-ink-soft); }
.cw-consent input { flex: none; width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--cw-accent); }
.cw-consent a { color: var(--cw-accent); text-underline-offset: 2px; }
.cw-card-submit {
  display: inline-flex; align-items: center; justify-content: center; min-height: 42px; padding: 10px 14px;
  border: 0; border-radius: 12px; cursor: pointer; text-decoration: none;
  font: 600 14px/1.2 var(--cw-font); color: #fff; background: var(--cw-accent); transition: opacity 150ms, transform 150ms;
}
.cw-card-submit:disabled { opacity: .5; cursor: default; }
.cw-card-submit:not(:disabled):active { transform: scale(.98); }
.cw-card-sent .cw-card-submit { background: var(--cw-ok); opacity: 1; }
.cw-card-error { margin: 0; font-size: 12.5px; line-height: 1.35; color: #c2410c; }
.cw-card-error:empty { display: none; }
.cw-booked-when { margin: 0; font: 600 16px/1.3 var(--cw-font-display); color: var(--cw-ink); }
.cw-booked-meta { margin: -4px 0 0; font-size: 12.5px; line-height: 1.4; color: var(--cw-ink-soft); overflow-wrap: anywhere; }
.cw-card-booked { box-shadow: 0 0 0 1px rgba(22, 163, 74, .35); }
.cw-trap { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

.cw-sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- phone: the panel takes the whole screen ---------- */
@media (max-width: 480px) {
  .cw-root { --cw-gap: 16px; }
  .cw-bubble { width: 56px; height: 56px; }
  .cw-panel {
    inset: 0; width: auto; height: 100%; border-radius: 0;
    padding-top: env(safe-area-inset-top, 0px);
    background: var(--cw-accent);
    /* while the keyboard slides in or out the panel lags the visible area by a frame or two:
       blue above it and white below it, so the page never flashes through */
    box-shadow: 0 -100vmax 0 100vmax var(--cw-accent), 0 100vmax 0 100vmax var(--cw-canvas);
  }
  .cw-panel > .cw-log, .cw-panel > .cw-chips, .cw-panel > .cw-form { background-clip: padding-box; }
  .cw-foot { padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px)); }
  .cw-root.cw-is-open .cw-bubble { opacity: 0; pointer-events: none; transform: scale(.6); }
  .cw-input, .cw-field-input { font-size: 16px; } /* no iOS zoom on focus */
  .cw-card { max-width: 100%; }
}
html.cw-lock, html.cw-lock body { overflow: hidden; }

/* ---------- phone: the bubble never sits on text or a button ----------
   While the page scrolls, or whenever text or a control lies under the bubble, it slides right
   and only a thin edge stays in view inside the page margin (index.html toggles .cw-docked). */
@media (max-width: 860px) {
  .cw-bubble { transition: transform 260ms cubic-bezier(.2, .8, .2, 1), box-shadow 200ms, opacity 200ms; }
  .cw-root.cw-docked:not(.cw-is-open) .cw-bubble { transform: translateX(calc(100% + var(--cw-gap) - 14px)); box-shadow: 0 4px 14px -4px rgba(33, 82, 255, .5); }
  .cw-root.cw-docked:not(.cw-is-open) .cw-bubble svg { opacity: 0; }
  .cw-root.cw-docked:not(.cw-is-open) .cw-dot { transform: scale(0); }
  .cw-root.cw-docked:not(.cw-is-open) .cw-bubble::before { content: ""; position: absolute; top: 0; bottom: 0; left: -14px; width: 42px; }   /* wider touch area for the edge */
  .cw-probe body * { pointer-events: auto !important; }
}

@media (prefers-reduced-motion: reduce) {
  .cw-bubble, .cw-panel, .cw-msg, .cw-card, .cw-bubble svg { transition: none !important; animation: none !important; }
  .cw-bubble.cw-pulse::after { animation: none; box-shadow: 0 0 0 4px rgba(33, 82, 255, .35); }
  .cw-typing i { animation: none; opacity: .6; }
}
