:root {
  --concierge-right: max(1.5rem, env(safe-area-inset-right));
  --concierge-bottom: max(1.5rem, env(safe-area-inset-bottom));
  --concierge-width: 7.75rem;
  --concierge-height: 3.125rem;
}

.chat-launcher {
  position: fixed;
  right: var(--concierge-right);
  bottom: var(--concierge-bottom);
  z-index: 75;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  width: var(--concierge-width);
  height: var(--concierge-height);
  margin: 0;
  padding: .5rem .75rem;
  border: 1px solid #8b9e97;
  border-radius: 2rem;
  background: #243d3b;
  color: white;
  box-shadow: 0 5px 24px #0003;
  font: inherit;
  font-size: .875rem;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
}
.chat-launcher > span:first-child { color: #dfc899; font-size: 1.25rem; }
.chat-launcher:focus-visible { outline: 3px solid #b79a60; outline-offset: 2px; }
.chat-panel[hidden] { display: none !important; }
.chat-panel {
  --panel-bottom: calc(var(--concierge-bottom) + var(--concierge-height) + .625rem);
  position: fixed;
  right: var(--concierge-right);
  bottom: var(--panel-bottom);
  z-index: 90;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  width: min(390px, calc(100% - var(--concierge-right) - max(.75rem, env(safe-area-inset-left))));
  height: 610px;
  max-height: calc(100dvh - var(--panel-bottom) - max(.75rem, env(safe-area-inset-top)));
  overflow: hidden;
  border: 1px solid #b5bfb9;
  border-radius: 14px;
  background: #fff;
  color: #243330;
  box-shadow: 0 16px 60px #0004;
  font-family: inherit;
}
.chat-panel > header { display: flex; align-items: center; gap: 10px; padding: 17px 18px; background: #243d3b; color: white; }
.chat-panel header > div { flex: 1; min-width: 0; }
.chat-panel header small { color: #d9c89e; font-size: 10px; letter-spacing: .14em; }
.chat-panel h2 { font-size: 17px; line-height: 1.5; margin: 4px 0 0; }
.chat-panel header button { width: 36px; height: 36px; border: 1px solid #84958f; background: transparent; color: white; border-radius: 50%; font-size: 23px; cursor: pointer; }
.chat-log { flex: 1; min-height: 60px; overflow-y: auto; overscroll-behavior: contain; padding: 18px; background: #f6f7f3; }
.chat-message { font-size: 14px; line-height: 1.85; white-space: pre-wrap; overflow-wrap: anywhere; padding: 12px 14px; border-radius: 10px; margin: 0 0 14px; background: white; border: 1px solid #e1e5de; }
.chat-message.user { margin-left: 30px; background: #e4ece8; border-color: #cbdad3; }
.chat-message a { color: #245e74; text-decoration: underline; }
.chat-starters { display: flex; gap: 6px; overflow-x: auto; padding: 9px 12px; flex-shrink: 0; }
.chat-starters:empty, .chat-status:empty { display: none; }
.chat-starters button { flex-shrink: 0; border: 1px solid #bbc9c1; background: #f6f7f3; padding: 7px 10px; border-radius: 15px; font-size: 12px; color: #2d5146; cursor: pointer; }
.chat-notice { padding: 0 16px 6px; font-size: 11px; line-height: 1.6; max-height: 120px; overflow: auto; }
.chat-notice summary { cursor: pointer; color: #4e6058; }
.chat-notice p { white-space: pre-wrap; margin: 8px 0; }
.chat-notice a { text-decoration: underline; }
.chat-status { padding: 0 16px; font-size: 12px; line-height: 1.6; color: #704b25; flex-shrink: 0; }
.chat-form { display: flex; gap: 8px; padding: 12px; }
.chat-form input { flex: 1; min-width: 0; border: 1px solid #afbeb4; border-radius: 7px; padding: 11px; font-size: 16px; color: #243330; background: #fff; }
.chat-form button { width: 44px; border: 0; border-radius: 7px; background: #294d48; color: white; font-size: 24px; cursor: pointer; }
.chat-panel button:disabled { opacity: .5; cursor: wait; }
.chat-footer { padding: 0 14px 10px; color: #607068; font-size: 10px; line-height: 1.5; white-space: pre-line; max-height: 45px; overflow: auto; }
.chat-panel:has(input:focus) { border-color: #6c8b7e; }

@media (max-width: 767px) {
  :root {
    --concierge-right: max(.8rem, env(safe-area-inset-right));
    --concierge-bottom: calc(74px + env(safe-area-inset-bottom));
    --concierge-width: 6.5rem;
    --concierge-height: 2.75rem;
  }
  .chat-launcher { font-size: .8125rem; }
  .public-portal { --concierge-bottom: max(.8rem, env(safe-area-inset-bottom)); }
}

@media (max-width: 1280px) {
  .public-portal {
    --form-clearance: calc(var(--concierge-bottom) + var(--concierge-height) + .625rem);
    padding-bottom: var(--form-clearance);
  }
  .public-portal .journey-next, .public-portal .booking-next-bar { bottom: var(--form-clearance); }
}
.public-portal .chat-launcher { z-index: 20; }
.public-portal .chat-panel { z-index: 21; }

@media (max-height: 520px) {
  .chat-panel { overflow-y: auto; overscroll-behavior: contain; }
  .chat-panel > * { flex-shrink: 0; }
  .chat-panel .chat-log { flex: 1 0 4rem; }
}
