:root {
  --brand: #0f6bff;
  --text: #17233b;
  --muted: #5b6b85;
  --border: #e3e8ee;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: #fff; color: var(--text); font-size: 15px; }

#app { display: flex; flex-direction: column; height: 100%; }
#app.loading, #app.error {
  align-items: center; justify-content: center; color: var(--muted); padding: 24px; text-align: center;
}

/* Hosted page: center the widget in a soft page frame */
body.hosted { background: #f6f8fa; }
body.hosted #app {
  max-width: 720px; margin: 0 auto; height: 100%;
  background: #fff; border-left: 1px solid var(--border); border-right: 1px solid var(--border);
}

header {
  display: flex; align-items: center; gap: 10px;
  background: var(--brand); color: #fff; padding: 14px 16px; flex-shrink: 0;
}
header .avatar {
  width: 30px; height: 30px; border-radius: 50%; background: rgba(255, 255, 255, 0.22);
  display: grid; place-items: center; font-size: 15px; font-weight: 700;
}
header .name { font-weight: 650; font-size: 15px; }
header .close {
  margin-left: auto; background: none; border: none; color: #fff; font-size: 20px;
  cursor: pointer; line-height: 1; padding: 4px 6px; opacity: 0.85;
}
body.hosted header .close { display: none; }

.log { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 84%; padding: 10px 13px; border-radius: 14px; line-height: 1.5; white-space: pre-wrap; word-wrap: break-word; }
.msg.bot { align-self: flex-start; background: #eef1f6; border-bottom-left-radius: 4px; }
.msg.me { align-self: flex-end; background: var(--brand); color: #fff; border-bottom-right-radius: 4px; }
.msg .src { margin-top: 7px; padding-top: 6px; border-top: 1px solid rgba(0,0,0,.09); font-size: 11.5px; color: var(--muted); }
.typing { align-self: flex-start; color: var(--muted); font-size: 13px; padding: 4px 2px; }
.msg .rate button {
  background: none; border: none; cursor: pointer; font-size: 14px; padding: 0 3px;
  opacity: 0.75; line-height: 1;
}
.msg .rate button:hover { opacity: 1; }

/* The chat composer only - page forms (.pform) lay out as documents. */
form#form { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--border); flex-shrink: 0; }
input {
  flex: 1; padding: 10px 13px; border: 1px solid var(--border); border-radius: 20px;
  font-size: 14px; font-family: inherit; outline: none; min-width: 0;
}
input:focus { border-color: var(--brand); }
button.send {
  border: none; background: var(--brand); color: #fff; border-radius: 20px;
  padding: 0 18px; font-size: 14px; font-weight: 600; cursor: pointer; font-family: inherit;
}
button.send:disabled { opacity: 0.45; cursor: default; }
footer { text-align: center; font-size: 11px; color: var(--muted); padding: 0 0 8px; }
footer a { color: var(--muted); }
.msg .body { display: block; white-space: pre-wrap; }

/* ── Booking / quote pages ─────────────────────────────────────────── */
body.page #app { max-width: 560px; }
.page-body { flex: 1; overflow-y: auto; padding: 18px; }
.page-body .lead { color: #57534e; margin-bottom: 14px; }
.choices { display: flex; flex-direction: column; gap: 8px; }
.choices.slots { flex-direction: row; flex-wrap: wrap; }
.choice {
  text-align: left; background: #fff; border: 1px solid #e7e5e4; border-radius: 10px;
  padding: 12px 14px; font: inherit; cursor: pointer; display: flex; flex-direction: column; gap: 2px;
}
.choice:hover { border-color: var(--brand); }
.choice.slot { flex-direction: row; width: auto; font-weight: 600; }
.c-name { font-weight: 600; }
.c-desc { color: #78716c; font-size: 13.5px; }
.c-meta { color: #57534e; font-size: 13.5px; }
.back { margin-top: 14px; }
.back a { color: var(--brand); }
.pform label { display: block; font-size: 13px; font-weight: 600; margin: 12px 0 4px; }
.pform input, .pform textarea {
  width: 100%; padding: 10px 12px; border: 1px solid #e7e5e4; border-radius: 8px;
  font: inherit; box-sizing: border-box;
}
.pform .hint, .page-body .hint { color: #78716c; font-size: 13.5px; margin-top: 10px; }
button.primary {
  margin-top: 14px; background: var(--brand); color: #fff; border: none; border-radius: 9px;
  padding: 12px 20px; font: inherit; font-weight: 650; cursor: pointer;
}
button.ghost {
  margin-top: 14px; background: transparent; color: #57534e; border: 1px solid #e7e5e4;
  border-radius: 9px; padding: 12px 20px; font: inherit; font-weight: 600; cursor: pointer;
}
button.danger {
  margin-top: 14px; background: transparent; color: #b91c1c; border: 1px solid #e7e5e4;
  border-radius: 9px; padding: 12px 20px; font: inherit; font-weight: 600; cursor: pointer;
}
button:disabled { opacity: 0.5; cursor: default; }
.form-err { color: #b91c1c; font-size: 13.5px; margin-top: 8px; min-height: 1em; }
.done { text-align: center; padding: 28px 8px; }
.done .tick {
  width: 52px; height: 52px; margin: 0 auto 12px; border-radius: 50%;
  background: #dcfce7; color: #15803d; font-size: 26px; line-height: 52px;
}
.done h2 { margin: 0 0 8px; }
.q-title { margin: 0 0 12px; }
.q-lines { width: 100%; border-collapse: collapse; }
.q-lines td { padding: 9px 0; border-bottom: 1px solid #e7e5e4; vertical-align: top; }
.q-lines .num { text-align: right; white-space: nowrap; }
.q-unit { display: block; color: #78716c; font-size: 13px; }
.q-lines tfoot td { border-bottom: none; padding: 6px 0; color: #57534e; }
.q-total td { font-weight: 700; color: #1c1917; font-size: 17px; }
.q-notes { margin-top: 14px; color: #57534e; }
.q-terms { margin-top: 10px; color: #78716c; font-size: 13px; }
.q-actions { display: flex; gap: 10px; }
.q-state { margin-top: 16px; font-weight: 600; }
.q-state.ok { color: #15803d; }
.stars { display: flex; gap: 6px; margin: 6px 0 4px; }
.star {
  background: none; border: none; font-size: 34px; line-height: 1; padding: 4px;
  cursor: pointer; color: #d6d3d1;
}
.star.on { color: #f59e0b; }
.primary-link {
  display: inline-block; margin-top: 6px; background: var(--brand); color: #fff;
  border-radius: 9px; padding: 12px 20px; font-weight: 650; text-decoration: none;
}
header .book-cta {
  margin-left: auto; margin-right: 10px; background: rgba(255,255,255,.16); color: #fff;
  padding: 6px 14px; border-radius: 16px; font-size: 13px; font-weight: 650;
  text-decoration: none; white-space: nowrap;
}
header .book-cta:hover { background: rgba(255,255,255,.26); }
.msg.bot a { color: var(--brand); font-weight: 600; text-decoration: underline; word-break: break-all; }

/* Identity lockup + quick actions + instant cards */
header .avatar.photo { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; }
header .who { min-width: 0; }
header .who .name { font-weight: 650; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
header .who .sub { font-size: 11.5px; opacity: .85; }
.chips { display: flex; gap: 8px; padding: 8px 12px 0; overflow-x: auto; flex-shrink: 0; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; border: 1px solid var(--border); background: #fff; color: var(--text);
  border-radius: 16px; padding: 6px 13px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
}
.chip:hover { border-color: var(--brand); color: var(--brand); }
.msg.card { background: #fff; border: 1px solid var(--border); max-width: 92%; }
.card-title { font-weight: 700; font-size: 13px; margin-bottom: 8px; }
.svc-row { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-top: 1px solid var(--border); }
.svc-nm { font-weight: 600; font-size: 14px; }
.svc-ds { color: var(--muted); font-size: 12.5px; }
.svc-pr { white-space: nowrap; font-size: 13px; color: var(--text); }
.hrs-row { display: flex; justify-content: space-between; gap: 14px; padding: 3px 0; font-size: 13.5px; }
.hrs-row span:first-child { font-weight: 600; }
.open-label { color: #15803d; font-weight: 650; font-size: 13px; margin-bottom: 6px; }
.about-p { font-size: 13.5px; margin: 4px 0 6px; white-space: pre-wrap; }
.card-act {
  display: inline-block; margin: 10px 8px 0 0; background: var(--brand); color: #fff;
  border-radius: 8px; padding: 8px 14px; font-size: 13px; font-weight: 650; text-decoration: none;
}
.card-act.ghosted { background: transparent; color: var(--brand); border: 1px solid var(--border); }
