/* Keys AI on the website (17 Nov 2026): the chat panel built by js/keys-ai-widget.js.
   Uses the site's own tokens (css/keys-premium.css: --kb-*) with fallbacks, so it matches the homepage, the content
   pages and the city pages. Everything is scoped under .kai-w. */
.kai-w {
  --kai-ink: var(--kb-ink, #0b1b2b);
  --kai-text: var(--kb-text, #33475b);
  --kai-muted: var(--kb-muted, #5b6d80);
  --kai-blue: var(--kb-blue, #005e8e);
  --kai-blue-ink: var(--kb-blue-ink, #00476b);
  --kai-line: var(--kb-line, #e3e8ee);
  --kai-soft: var(--kb-soft, #f5f7fa);
  --kai-paper: #ffffff;
  --kai-live: #1f9d6b;
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 2147482000;
  font-family: var(--kb-font, "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif);
  font-size: 15px;
  line-height: 1.5;
  color: var(--kai-text);
  -webkit-font-smoothing: antialiased;
}
.kai-w *, .kai-w *::before, .kai-w *::after { box-sizing: border-box; }
.kai-w[hidden] { display: none !important; }
.kai-w:not(.kai-w--ready) { visibility: hidden; }

/* ---------- minimized bar ---------- */
.kai-w__bar {
  display: flex; align-items: center; gap: 12px;
  min-width: 250px; padding: 10px 16px 10px 10px;
  border: 0; border-radius: 14px; cursor: pointer;
  background: var(--kai-ink); color: #fff; text-align: left;
  box-shadow: 0 12px 32px rgba(11, 27, 43, 0.28);
  font: inherit;
}
.kai-w__bar:hover { background: #12283d; }
.kai-w__bar:focus-visible, .kai-w__icon:focus-visible, .kai-w__send:focus-visible, .kai-w__chip:focus-visible {
  outline: 3px solid #7cc4e8; outline-offset: 2px;
}
.kai-w__bar-text { display: flex; flex-direction: column; line-height: 1.25; }
.kai-w__bar-text strong { font-size: 15px; font-weight: 800; letter-spacing: -0.01em; }
.kai-w__bar-text span { font-size: 13px; color: #b9c8d6; }
.kai-w__chev { margin-left: auto; width: 10px; height: 10px; border-left: 2px solid #b9c8d6; border-top: 2px solid #b9c8d6; transform: rotate(45deg) translateY(3px); }
/* The Keys logo (a wide wordmark) on a white tag, so it reads on the dark bar and header. */
.kai-w__mark {
  display: inline-grid; place-items: center; flex: none;
  width: 64px; height: 34px; border-radius: 10px; padding: 0 6px;
  background: #fff; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12);
}
.kai-w__mark img { display: block; width: 52px; height: auto; }
.kai-w--open .kai-w__bar { display: none; }

/* ---------- panel ---------- */
.kai-w__panel {
  display: none; flex-direction: column;
  width: 384px; height: min(600px, calc(100vh - 40px));
  background: var(--kai-paper);
  border: 1px solid var(--kai-line); border-radius: 18px; overflow: hidden;
  box-shadow: 0 24px 60px rgba(11, 27, 43, 0.22), 0 2px 6px rgba(11, 27, 43, 0.08);
}
.kai-w--open .kai-w__panel { display: flex; animation: kai-in 220ms ease-out; }
@keyframes kai-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

.kai-w__head {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 10px 12px 14px;
  background: var(--kai-ink); color: #fff;
}
.kai-w__mark--head { width: 64px; height: 32px; }
.kai-w__title { display: flex; flex-direction: column; line-height: 1.2; margin-right: auto; }
.kai-w__title strong { font-size: 16px; font-weight: 800; letter-spacing: -0.01em; }
.kai-w__title span { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: #b9c8d6; }
.kai-w__dot { width: 7px; height: 7px; border-radius: 50%; background: var(--kai-live); box-shadow: 0 0 0 3px rgba(31, 157, 107, 0.25); }
.kai-w__icon {
  display: inline-grid; place-items: center;
  width: 34px; height: 34px; border: 0; border-radius: 9px;
  background: transparent; color: #d6e1ea; cursor: pointer;
}
.kai-w__icon:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }

.kai-w__log {
  flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain;
  display: flex; flex-direction: column; gap: 10px;
  padding: 16px 14px 8px;
  background: var(--kai-soft);
}
.kai-w__msg {
  max-width: 86%; padding: 10px 13px; border-radius: 14px;
  overflow-wrap: anywhere;
}
.kai-w__msg p { margin: 0; color: inherit; line-height: 1.5; }
.kai-w__msg p + p, .kai-w__msg p + ul, .kai-w__msg ul + p { margin-top: 6px; }
.kai-w__msg ul { margin: 4px 0 0; padding-left: 18px; }
.kai-w__msg li { margin: 2px 0; }
.kai-w__msg--ai {
  align-self: flex-start;
  background: var(--kai-paper); color: var(--kai-ink);
  border: 1px solid var(--kai-line); border-bottom-left-radius: 4px;
}
.kai-w__msg--me {
  align-self: flex-end;
  background: var(--kai-blue); color: #fff;
  border-bottom-right-radius: 4px; white-space: pre-wrap;
}
.kai-w__msg a { color: var(--kai-blue); font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }
.kai-w__msg a:hover { color: var(--kai-blue-ink); }
.kai-w__msg strong { color: var(--kai-ink); font-weight: 800; }
.kai-w__img {
  display: block; width: 100%; max-width: 168px; margin: 6px 0 4px;
  border: 1px solid var(--kai-line); border-radius: 10px; background: #fff;
  aspect-ratio: 4 / 3; object-fit: contain;
}

.kai-w__typing { display: flex; align-items: center; gap: 4px; color: var(--kai-muted); }
.kai-w__typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--kai-muted); animation: kai-dot 1s infinite ease-in-out; }
.kai-w__typing span:nth-child(2) { animation-delay: 0.15s; }
.kai-w__typing span:nth-child(3) { animation-delay: 0.3s; }
.kai-w__typing em { margin-left: 6px; font-style: normal; font-size: 13px; }
@keyframes kai-dot { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }

.kai-w__chips {
  display: flex; flex-wrap: wrap; gap: 8px;
  padding: 4px 14px 10px; background: var(--kai-soft);
}
.kai-w__chips[hidden] { display: none; }
.kai-w__chip {
  padding: 7px 12px; border: 1px solid #c9d6e2; border-radius: 999px;
  background: #fff; color: var(--kai-blue-ink); cursor: pointer;
  font: inherit; font-size: 13.5px; font-weight: 700;
}
.kai-w__chip:hover { border-color: var(--kai-blue); background: #eef6fb; }

.kai-w__check { padding: 0 14px; background: var(--kai-paper); }
.kai-w__check:empty { display: none; }
.kai-w__check iframe { margin-top: 8px; }

.kai-w__form {
  display: flex; align-items: flex-end; gap: 8px;
  padding: 10px 12px; border-top: 1px solid var(--kai-line); background: var(--kai-paper);
}
.kai-w__input {
  flex: 1; min-height: 42px; max-height: 120px; resize: none; overflow-y: hidden;
  padding: 10px 12px; border: 1px solid #c9d6e2; border-radius: 12px;
  font: inherit; font-size: 16px; /* 16px stops iPhone zooming in */
  color: var(--kai-ink); background: #fff; line-height: 1.35;
}
.kai-w__input:focus { outline: none; border-color: var(--kai-blue); box-shadow: 0 0 0 3px rgba(0, 94, 142, 0.15); }
.kai-w__send {
  display: inline-grid; place-items: center; flex: none;
  width: 42px; height: 42px; border: 0; border-radius: 12px;
  background: var(--kai-blue); color: #fff; cursor: pointer;
}
.kai-w__send:hover { background: var(--kai-blue-ink); }
.kai-w__send:disabled { opacity: 0.5; cursor: default; }
.kai-w__foot { margin: 0; padding: 0 14px 10px; background: var(--kai-paper); font-size: 11.5px; color: var(--kai-muted); }

/* The page's own "back to top" button moves up out of the way. */
body.kai-on .go-top { bottom: 96px !important; }

/* ---------- phones: compact until the visitor starts chatting, never hiding the page ---------- */
@media (max-width: 600px) {
  .kai-w { right: 10px; left: 10px; bottom: 10px; }
  .kai-w__bar { width: 100%; }
  .kai-w__panel { width: 100%; height: auto; max-height: calc(100vh - 20px); border-radius: 16px; }
  .kai-w__log { max-height: 30vh; padding-top: 12px; }
  .kai-w__chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .kai-w__chips::-webkit-scrollbar { display: none; }
  .kai-w__chip { flex: none; }
  .kai-w__foot { display: none; }
  .kai-w--chatting .kai-w__panel { height: calc(100vh - 20px); height: calc(100dvh - 20px); }
  .kai-w--chatting .kai-w__log { max-height: none; }
  .kai-w--chatting .kai-w__foot { display: block; }
}

@media (prefers-reduced-motion: reduce) {
  .kai-w--open .kai-w__panel { animation: none; }
  .kai-w__typing span { animation: none; opacity: 0.6; }
}

/* Before the visitor writes anything, the panel is only as tall as the greeting (less of the page covered). */
.kai-w:not(.kai-w--chatting) .kai-w__panel { height: auto; }
.kai-w:not(.kai-w--chatting) .kai-w__log { flex: 0 1 auto; min-height: 0; }
/* Never taller than the window (26 Nov 2026: the short form grew the panel past the top of the screen, so its top
   could not be reached): the conversation area and the location bar scroll inside the panel instead. */
@media (min-width: 601px) {
  .kai-w__panel { max-height: calc(100vh - 40px); max-height: calc(100dvh - 40px); }
}
/* The conversation gives up the room first; the location bar only shrinks (and scrolls) on a very short window. */
.kai-w__loc { flex: 0 0.02 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }

/* ---------- the location bar (25 Nov 2026, Jamal: "Use my location" / "Enter address", one confirmed place) ---------- */
.kai-w__loc { padding: 10px 14px 12px; background: var(--kai-soft); border-top: 1px solid var(--kai-line); }
.kai-w__loc p { margin: 0; }
.kai-w__pin { flex: none; color: var(--kai-blue); margin-top: 1px; }
.kai-w__loc-intro, .kai-w__loc-summary, .kai-w__loc-place { display: flex; align-items: flex-start; gap: 8px; font-size: 14px; color: var(--kai-ink); }
.kai-w__loc-intro { font-weight: 700; margin-bottom: 8px !important; }
.kai-w__loc-summary span, .kai-w__loc-place span { overflow-wrap: anywhere; }
.kai-w__loc-summary em { display: block; font-style: normal; color: var(--kai-muted); font-size: 12.5px; }
.kai-w__loc-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.kai-w__loc-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }
.kai-w__loc-primary, .kai-w__loc-secondary {
  min-height: 42px; padding: 9px 16px; border-radius: 12px; cursor: pointer;
  font: inherit; font-size: 14.5px; font-weight: 800;
}
.kai-w__loc-primary { border: 0; background: var(--kai-blue); color: #fff; }
.kai-w__loc-primary:hover { background: var(--kai-blue-ink); }
.kai-w__loc-primary:disabled { opacity: 0.7; cursor: progress; }
.kai-w__loc-secondary { border: 1px solid #c9d6e2; background: #fff; color: var(--kai-blue-ink); }
.kai-w__loc-secondary:hover { border-color: var(--kai-blue); background: #eef6fb; }
.kai-w__link { border: 0; background: none; padding: 6px 2px; color: var(--kai-blue); font: inherit; font-size: 13.5px; font-weight: 800; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; flex: none; }
.kai-w__loc-label { display: block; margin: 8px 0 4px; font-size: 12.5px; font-weight: 700; color: var(--kai-text); }
.kai-w__loc-line { display: flex; gap: 8px; }
.kai-w__loc-input {
  flex: 1; width: 100%; min-height: 42px; padding: 9px 12px; border: 1px solid #c9d6e2; border-radius: 12px;
  font: inherit; font-size: 16px; color: var(--kai-ink); background: #fff;
}
.kai-w__loc-input:focus, .kai-w__loc-primary:focus-visible, .kai-w__loc-secondary:focus-visible, .kai-w__link:focus-visible {
  outline: none; box-shadow: 0 0 0 3px rgba(0, 94, 142, 0.25);
}
.kai-w__loc-card { background: #fff; border: 1px solid var(--kai-line); border-radius: 14px; padding: 12px; }
.kai-w__loc-q { font-weight: 800; color: var(--kai-ink); margin-bottom: 6px !important; }
.kai-w__loc-warn { margin-top: 6px !important; font-size: 12.5px; color: #8a5a00; background: #fff7e6; border-radius: 8px; padding: 6px 8px; }
.kai-w__loc-error { margin: 6px 0 0 !important; font-size: 13px; color: #b42318; }
.kai-w__loc-live { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.kai-w__loc--confirmed { padding-top: 8px; padding-bottom: 8px; }

/* Opened from a "Request service" button on a phone: use the screen for the booking. */
@media (max-width: 600px) {
  .kai-w.kai-w--full:not(.kai-w--x) .kai-w__panel { height: calc(100vh - 20px); height: calc(100dvh - 20px); }
  .kai-w.kai-w--full:not(.kai-w--x) .kai-w__log { max-height: none; flex: 1; }
  .kai-w.kai-w--full:not(.kai-w--x) .kai-w__chips { flex-wrap: wrap; overflow-x: visible; }
  .kai-w__loc-actions .kai-w__loc-primary, .kai-w__loc-actions .kai-w__loc-secondary { flex: 1 1 auto; }
}

/* ---------- the request summary card (25 Nov 2026, part 2) ---------- */
.kai-w__card { align-self: stretch; background: #fff; border: 1px solid #c9d6e2; border-radius: 14px; padding: 12px 14px; box-shadow: 0 6px 18px -12px rgba(11, 27, 43, 0.35); }
.kai-w__card p { margin: 0; }
.kai-w__card-title { font-weight: 800; color: var(--kai-ink); font-size: 15px; margin-bottom: 8px !important; }
.kai-w__card-facts { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0 0 10px; font-size: 13.5px; }
.kai-w__card-facts dt { color: var(--kai-muted); font-weight: 600; }
.kai-w__card-facts dd { margin: 0; color: var(--kai-ink); overflow-wrap: anywhere; }
.kai-w__card-q { font-weight: 800; color: var(--kai-ink); margin-top: 4px !important; }
.kai-w__card-go { width: 100%; margin-top: 12px; }
.kai-w__card-help { margin-top: 6px !important; font-size: 12.5px; color: var(--kai-muted); }
.kai-w__card-status { font-weight: 700; color: #11643f; background: #e9f7f0; border-radius: 8px; padding: 8px 10px; font-size: 13.5px; }
.kai-w__loc-note { display: block; margin-top: 2px !important; font-size: 12.5px; color: var(--kai-muted); font-weight: 400; }
.kai-w__loc-input[aria-invalid="true"] { border-color: #b42318; }

/* ---------- part 3 (25 Nov 2026): recovery, the short form, the phone keyboard ---------- */
.kai-w__recover { display: flex; flex-wrap: wrap; gap: 8px; align-self: stretch; }
.kai-w__recover .kai-w__loc-primary, .kai-w__recover .kai-w__loc-secondary { flex: 1 1 auto; }
.kai-w__fs { border: 0; margin: 0 0 4px; padding: 0; min-width: 0; }
.kai-w__fs legend { padding: 0; float: none; width: auto; }
.kai-w__radio { display: flex; align-items: center; gap: 8px; min-height: 36px; font-size: 14px; color: var(--kai-ink); cursor: pointer; margin: 0; }
.kai-w__radio input { width: 18px; height: 18px; accent-color: var(--kai-blue); flex: none; }
.kai-w__form-car, .kai-w__form-key { margin-top: 2px; }
.kai-w__form-car[hidden], .kai-w__form-key[hidden] { display: none; }
.kai-w__form-place { margin-top: 10px !important; font-size: 13px; color: var(--kai-ink); font-weight: 700; overflow-wrap: anywhere; }
.kai-w__foot-link { font-size: 11.5px; padding: 0; }
.kai-w__recover[hidden] { display: none; }
@media (max-width: 600px) {
  /* The on-screen keyboard shrinks the visible area: the panel follows it, so the box being typed in stays in view. */
  .kai-w--chatting .kai-w__panel,
  .kai-w.kai-w--full:not(.kai-w--x) .kai-w__panel { height: calc(var(--kai-vh, 100dvh) - 20px); max-height: calc(var(--kai-vh, 100dvh) - 20px); }
}

/* ---------- quotes, review, payment, status (25 Nov 2026) ---------- */
.kai-w__quotes { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 8px; }
.kai-w__quote { border: 1px solid var(--kai-line); border-radius: 12px; padding: 10px 12px; background: var(--kai-soft); }
.kai-w__quote--on { border-color: var(--kai-blue); box-shadow: 0 0 0 2px rgba(0, 94, 142, 0.18); }
.kai-w__quote-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.kai-w__quote-top strong { color: var(--kai-ink); overflow-wrap: anywhere; }
.kai-w__quote-price { font-weight: 800; color: var(--kai-ink); white-space: nowrap; }
.kai-w__quote-facts { margin: 4px 0 0 !important; font-size: 12.5px; color: var(--kai-muted); }
.kai-w__quote-go { margin-top: 8px; width: 100%; min-height: 40px; }
.kai-w__pay { display: block; text-align: center; text-decoration: none; margin-top: 10px; line-height: 24px; }
.kai-w__pay:hover { color: #fff; }
.kai-w__card-status--payment { color: #8a5a00; background: #fff7e6; }
.kai-w__card-status--no_quotes, .kai-w__card-status--cancelled { color: var(--kai-text); background: var(--kai-soft); }

/* map preview + pin (25 Nov 2026) */
.kai-w__map { height: 150px; border-radius: 10px; margin-top: 8px; border: 1px solid var(--kai-line); overflow: hidden; z-index: 0; }
.kai-w__map .leaflet-control-attribution { font-size: 9px; }
.kai-w__map-hint { margin: 4px 0 0 !important; font-size: 12px; color: var(--kai-muted, #5b6472); }
/* address suggestions */
.kai-w__suggestions { list-style: none; margin: 4px 0 0; padding: 0; border: 1px solid var(--kai-line); border-radius: 10px; background: #fff; max-height: 200px; overflow-y: auto; }
.kai-w__suggestions li + li { border-top: 1px solid var(--kai-line); }
.kai-w__suggest { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 9px 10px; font: inherit; font-size: 13.5px; color: var(--kai-ink); cursor: pointer; min-height: 40px; }
.kai-w__suggest:hover, .kai-w__suggest:focus-visible { background: #f2f6fb; outline: none; }
/* previous place */
.kai-w__loc-prev { display: block; width: 100%; margin-top: 8px; text-align: left; background: #fff; border: 1px dashed var(--kai-line); border-radius: 10px; padding: 8px 10px; font: inherit; font-size: 13px; color: var(--kai-ink); cursor: pointer; overflow-wrap: anywhere; }
.kai-w__loc-prev span { font-weight: 600; }
.kai-w__loc-prev:focus-visible { outline: 2px solid var(--kai-blue); outline-offset: 2px; }
