/* ==========================================================================
   Chat Widget — public sites
   Floating AI chat assistant + Help Desk page styles
   ========================================================================== */

/* ---------- Streaming text animation ---------- */
.cw-msg-ai.cw-streaming {
  overflow: hidden;
}
.cw-msg-ai .cw-cursor {
  display: inline-block;
  width: 2px;
  height: 1em;
  background: var(--cw-teal, var(--brand-accent));
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: cw-blink 0.6s step-end infinite;
}
@keyframes cw-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}
.cw-msg-ai p, .cw-msg-ai li, .cw-msg-ai strong, .cw-msg-ai em {
  animation: cw-fadein 0.15s ease-out;
}
@keyframes cw-fadein {
  from { opacity: 0.4; }
  to { opacity: 1; }
}
/* Help desk streaming */
.hd-msg-ai.hd-streaming .cw-cursor {
  display: inline-block;
}

/* ---------- User profile avatar in navbar ---------- */
.nav-user-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--brand-accent);
  color: #fff !important;
  text-decoration: none !important;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}
.nav-user-avatar:hover {
  transform: scale(1.08);
  box-shadow: 0 2px 8px rgba(8, 145, 178, 0.3);
}
.nav-user-avatar::after {
  display: none !important;
}
.nav-user-initials {
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.5px;
}
.nav-user-info {
  display: flex;
  flex-direction: column;
  padding: 8px 16px;
  gap: 2px;
  pointer-events: none;
}
.nav-user-info strong {
  font-size: 13px;
  color: var(--brand-primary);
}
.nav-user-info small {
  font-size: 11px;
  color: #9ca3af;
}

/* ---------- Language switcher (navbar) ---------- */
/* Language dropdown */
.lang-dropdown-wrap {
  position: relative;
}

.lang-trigger {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px 8px;
  border: 1px solid rgba(255,255,255,0.22);
  border-radius: 8px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  font-family: 'Inter', sans-serif;
  letter-spacing: 0.04em;
  transition: all 0.15s;
  opacity: 0.75;
}

.lang-trigger:hover,
.lang-dropdown-wrap.open .lang-trigger {
  opacity: 1;
  background: rgba(255,255,255,0.1);
}

.navbar.scrolled .lang-trigger {
  border-color: rgba(27,58,92,0.18);
  color: var(--brand-primary);
}

.navbar.scrolled .lang-trigger:hover,
.navbar.scrolled .lang-dropdown-wrap.open .lang-trigger {
  background: rgba(27,58,92,0.06);
}

.lang-dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 6px;
  background: #fff;
  border: 1px solid rgba(27,58,92,0.12);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  padding: 4px;
  min-width: 130px;
  z-index: 600;
}

.lang-dropdown-wrap.open .lang-dropdown-menu {
  display: block;
}

.lang-option {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 8px 12px;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: #374151;
  font-size: 13px;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  text-align: left;
  transition: background 0.12s;
}

.lang-option:hover {
  background: #F3F4F6;
  color: #111827;
}

.lang-option.active {
  color: var(--brand-primary);
  font-weight: 700;
  background: #EFF6FF;
}

/* ---------- Search trigger button (navbar) ---------- */
.search-trigger {
  background: none;
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 8px;
  padding: 6px 8px;
  cursor: pointer;
  color: inherit;
  display: inline-flex;
  align-items: center;
  transition: all 0.2s;
}
.search-trigger:hover {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.5);
}
.navbar.scrolled .search-trigger {
  border-color: rgba(27,58,92,0.2);
}
.navbar.scrolled .search-trigger:hover {
  background: rgba(27,58,92,0.05);
}

/* ---------- Design tokens ---------- */
:root {
  --cw-navy: var(--brand-primary);
  --cw-teal: var(--brand-accent);
  --cw-sand: var(--brand-surface);
  --cw-gold: var(--brand-cta);
  --cw-white: #ffffff;
  --cw-gray-50: #f9fafb;
  --cw-gray-100: #f3f4f6;
  --cw-gray-200: #e5e7eb;
  --cw-gray-300: #d1d5db;
  --cw-gray-500: #6b7280;
  --cw-gray-700: #374151;
  --cw-gray-900: #111827;
  --cw-radius: 12px;
  --cw-radius-sm: 8px;
  --cw-shadow: 0 8px 32px rgba(27, 58, 92, .18), 0 2px 8px rgba(0,0,0,.08);
  --cw-font: 'Inter', system-ui, -apple-system, sans-serif;
}

/* ---------- FAB Button ---------- */
.cw-fab {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--cw-navy);
  color: var(--cw-white);
  border: none;
  cursor: pointer;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(27, 58, 92, .35);
  transition: transform .2s ease, box-shadow .2s ease;
}
.cw-fab:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 24px rgba(27, 58, 92, .45);
}
.cw-fab:active {
  transform: scale(.96);
}
.cw-fab svg {
  width: 26px;
  height: 26px;
  fill: currentColor;
  transition: opacity .2s ease;
}
.cw-fab .cw-fab-close { display: none; }
.cw-fab.cw-open .cw-fab-chat  { display: none; }
.cw-fab.cw-open .cw-fab-close { display: block; }

/* Pulse on first load */
@keyframes cw-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(8, 145, 178, .5); }
  70%  { box-shadow: 0 0 0 14px rgba(8, 145, 178, 0); }
  100% { box-shadow: 0 0 0 0 rgba(8, 145, 178, 0); }
}
.cw-fab.cw-pulse {
  animation: cw-pulse 2s ease 3;
}

/* ---------- Chat Panel ---------- */
.cw-panel {
  position: fixed;
  bottom: 88px;
  right: 20px;
  width: 380px;
  max-height: 520px;
  background: var(--cw-white);
  border-radius: var(--cw-radius);
  box-shadow: var(--cw-shadow);
  z-index: 9998;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: var(--cw-font);

  /* slide-up animation */
  opacity: 0;
  transform: translateY(16px) scale(.97);
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
}
.cw-panel.cw-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* ---------- Header ---------- */
.cw-header {
  /* Primary colour with its computed text colour (brand.js --brand-on-primary): never a fixed white. */
  background: var(--brand-primary);
  color: var(--brand-on-primary, #fff);
  padding: 10px 8px 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-shrink: 0;
}
.cw-header-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.cw-header-title {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cw-header-subtitle {
  font-size: 12px;
  font-weight: 400;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cw-header-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}
.cw-badge-slot { display: inline-flex; margin-right: 4px; }
.cw-header-actions > .cw-ai-badge { margin-right: 4px; }

/* Icon buttons (header and answers): 32 × 32 hit area, visible focus ring, colour from the context. */
.cw-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  min-width: 32px;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  transition: box-shadow .15s;
}
.cw-icon-btn svg { width: 18px; height: 18px; pointer-events: none; }
.cw-icon-btn:hover { box-shadow: inset 0 0 0 1px currentColor; }
.cw-icon-btn:focus-visible { outline: 2px solid currentColor; outline-offset: -2px; }
.cw-icon-btn[hidden], .cw-more[hidden] { display: none !important; }

/* Copy and save: in the header when the panel is wide, in the «more» menu when it is narrow. */
.cw-panel .cw-hdr-wide { display: none; }
.cw-panel[data-chat-size="expanded"] .cw-hdr-wide { display: inline-flex; }
.cw-panel[data-chat-size="expanded"] .cw-hdr-narrow { display: none; }
.cw-more { position: relative; display: inline-flex; }
.cw-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 3;
  min-width: 220px;
  padding: 4px;
  background: var(--cw-white);
  border: 1px solid var(--cw-gray-200);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .14);
}
.cw-menu[hidden] { display: none; }
.cw-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 36px;
  padding: 6px 10px;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--cw-gray-900);
  font-family: var(--cw-font);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}
.cw-menu-item { white-space: nowrap; }
.cw-menu-item svg { width: 16px; height: 16px; flex-shrink: 0; }
.cw-menu-item:hover, .cw-menu-item:focus-visible { background: var(--cw-gray-100); outline: none; box-shadow: inset 0 0 0 2px var(--brand-primary); }
.cw-menu-item[hidden] { display: none; }
.cw-icon-btn:disabled, .cw-menu-item:disabled { opacity: .55; cursor: progress; }

/* Deleting the conversation: the inline confirmation above the input (never window.confirm) */
.cw-delete-confirm {
  margin: 8px 12px;
  padding: 10px 12px;
  background: #fef2f2;
  color: #7f1d1d;
  border: 1px solid #fecaca;
  border-radius: var(--cw-radius-sm);
  font-family: var(--cw-font);
  font-size: 13px;
}
.cw-delete-confirm p { margin: 0 0 8px; line-height: 1.45; }
.cw-delete-confirm-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.cw-delete-confirm button {
  min-height: 32px;
  padding: 6px 14px;
  border-radius: 8px;
  font: 600 13px var(--cw-font);
  cursor: pointer;
}
.cw-delete-yes { background: #b91c1c; color: #ffffff; border: 1px solid #b91c1c; }
.cw-delete-no { background: var(--cw-white); color: var(--cw-gray-900); border: 1px solid var(--cw-gray-300); }
.cw-delete-confirm button:focus-visible { outline: 2px solid #7f1d1d; outline-offset: 2px; }
.cw-delete-confirm button:disabled { opacity: .7; cursor: progress; }

/* The copy button under a completed answer */
.cw-msg-actions {
  display: flex;
  justify-content: flex-end;
  margin: 4px -8px -6px 0;
}
.cw-msg-actions .cw-icon-btn { color: var(--cw-gray-700); }
.cw-msg-actions .cw-icon-btn svg { width: 16px; height: 16px; }
.cw-icon-btn.cw-done { color: #15803d; }

/* «Copied» and «Saved» for screen readers */
.cw-sr-live {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* When the browser refused to copy: the text, selected, with the message that says so */
.cw-copy-fallback {
  position: relative;
  margin: 8px 12px;
  padding: 10px 40px 10px 12px;
  background: #fef3c7;
  color: #78350f;
  border-radius: var(--cw-radius-sm);
  font-size: 13px;
}
.cw-copy-fallback p { margin: 0 0 6px; }
.cw-copy-fallback textarea {
  width: 100%;
  min-height: 90px;
  box-sizing: border-box;
  font: 12px/1.4 ui-monospace, monospace;
  color: var(--cw-gray-900);
}
.cw-copy-fallback .cw-copy-fallback-close { position: absolute; top: 4px; right: 4px; }
/* Persistent AI disclosure (cemi-responsible-ai-use rule 1) */
.cw-ai-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border: 1px solid currentColor;
  border-radius: 999px;
  color: inherit;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
  line-height: 1.4;
  text-decoration: none;
  white-space: nowrap;
}
.cw-ai-badge:hover {
  box-shadow: inset 0 0 0 1px currentColor;
}
.cw-ai-badge:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

/* ---------- Messages Area ---------- */
.cw-messages {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 14px 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 320px;
  scroll-behavior: smooth;
}

/* Scrollbar */
.cw-messages::-webkit-scrollbar { width: 5px; }
.cw-messages::-webkit-scrollbar-track { background: transparent; }
.cw-messages::-webkit-scrollbar-thumb { background: var(--cw-gray-300); border-radius: 3px; }

/* ---------- Message Bubbles ---------- */
.cw-msg {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  word-wrap: break-word;
}
.cw-msg a {
  color: inherit;
  text-decoration: underline;
}
.cw-msg-ai {
  align-self: flex-start;
  background: var(--cw-gray-100);
  color: var(--cw-gray-900);
  border-bottom-left-radius: 4px;
}
.cw-msg-user {
  align-self: flex-end;
  background: var(--brand-primary);
  color: var(--brand-on-primary, #fff);
  border-bottom-right-radius: 4px;
}

/* Markdown inside AI messages */
.cw-msg-ai strong { font-weight: 600; }
.cw-msg-ai em { font-style: italic; }
.cw-msg-ai ul,
.cw-msg-ai ol {
  margin: 6px 0;
  padding-left: 18px;
}
.cw-msg-ai li { margin-bottom: 2px; }

/* ---------- Rich markers ---------- */
.cw-contact-cta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 8px 0 2px;
}
.cw-contact-cta a {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: background .15s, color .15s;
}
.cw-contact-cta a:hover { filter: brightness(.88); }
.cw-contact-cta a:focus-visible { outline: 2px solid var(--brand-primary); outline-offset: 2px; }
.cw-cta-phone {
  background: var(--brand-primary);
  color: var(--brand-on-primary, #fff) !important;
}
/* WhatsApp green darkened so white text reads (5.0:1; #25d366 gave 2.0:1). */
.cw-cta-whatsapp {
  background: #15803d;
  color: #fff !important;
}
/* The darker CTA step: --brand-on-cta is chosen for both the CTA colour and this shade. */
.cw-cta-form {
  background: var(--brand-cta-dark);
  color: var(--brand-on-cta, #fff) !important;
}

/* ---------- Inline pills: calculator, region, project, all properties ----------
   They sit in the sentence: never a line break forced before them, they wrap as a unit, and their text
   is near-black on the light surface colour (the hover takes the primary with its computed «on» colour). */
.cw-calculator-link,
.cw-pill-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  margin: 0 2px;
  padding: 1px 10px;
  vertical-align: baseline;
  white-space: nowrap;
  border: 1px solid var(--brand-primary);
  border-radius: 999px;
  background: var(--brand-surface);
  color: var(--cw-gray-900) !important;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.45;
  text-decoration: none !important;
  transition: background .15s, color .15s;
}
.cw-calculator-link svg,
.cw-pill-link svg { flex-shrink: 0; }
.cw-calculator-link:hover,
.cw-pill-link:hover {
  background: var(--brand-primary);
  color: var(--brand-on-primary, #fff) !important;
}
.cw-calculator-link:focus-visible,
.cw-pill-link:focus-visible { outline: 2px solid var(--brand-primary); outline-offset: 2px; }

/* ---------- Typing Indicator ---------- */
.cw-typing {
  align-self: flex-start;
  display: flex;
  gap: 4px;
  padding: 10px 16px;
  background: var(--cw-gray-100);
  border-radius: 16px;
  border-bottom-left-radius: 4px;
}
.cw-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--cw-gray-500);
  animation: cw-dot 1.4s ease-in-out infinite;
}
.cw-typing span:nth-child(2) { animation-delay: .2s; }
.cw-typing span:nth-child(3) { animation-delay: .4s; }

@keyframes cw-dot {
  0%, 80%, 100% { opacity: .3; transform: scale(.8); }
  40% { opacity: 1; transform: scale(1); }
}

/* ---------- Suggested Questions (Chips) ---------- */
.cw-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px 14px 10px;
}
.cw-chip {
  background: transparent;
  border: 1.5px solid var(--brand-primary);
  color: var(--cw-gray-900);
  font-family: var(--cw-font);
  font-size: 12.5px;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 20px;
  cursor: pointer;
  transition: background .15s, color .15s;
  white-space: nowrap;
}
.cw-chip:hover {
  background: var(--brand-primary);
  color: var(--brand-on-primary, #fff);
}
.cw-chip:focus-visible { outline: 2px solid var(--brand-primary); outline-offset: 2px; }
.cw-suggestions[hidden] { display: none; }

/* ---------- Input Area ---------- */
.cw-input-area {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--cw-gray-200);
  flex-shrink: 0;
}
.cw-input {
  flex: 1;
  border: 1.5px solid var(--cw-gray-200);
  border-radius: 20px;
  padding: 8px 16px;
  font-family: var(--cw-font);
  font-size: 14px;
  outline: none;
  transition: border-color .15s;
}
.cw-input:focus {
  border-color: var(--brand-primary);
}
.cw-input::placeholder {
  color: var(--cw-gray-500);
}
.cw-input:disabled {
  background: var(--cw-gray-50);
  cursor: not-allowed;
}
.cw-send-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--brand-primary);
  color: var(--brand-on-primary, #fff);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: filter .15s, opacity .15s;
}
.cw-send-btn:hover { filter: brightness(.88); }
.cw-send-btn:focus-visible { outline: 2px solid var(--brand-primary); outline-offset: 2px; }
.cw-send-btn:disabled {
  opacity: .45;
  cursor: not-allowed;
}
.cw-send-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

/* ---------- Rate Limit Banner ---------- */
.cw-rate-limit {
  padding: 10px 14px;
  background: #fef3c7;
  color: #92400e;
  font-size: 13px;
  text-align: center;
  border-top: 1px solid #fde68a;
}

/* ---------- Lead Capture Form ---------- */
.cw-lead-form {
  margin: 0;
  padding: 12px 14px;
  background: var(--cw-sand);
  border-radius: var(--cw-radius-sm);
}
.cw-lead-form p {
  font-size: 13px;
  font-weight: 600;
  color: var(--cw-navy);
  margin: 0 0 10px;
}
.cw-legal-note,
.cw-lead-form p.cw-legal-note {
  font-size: 11px;
  font-weight: 400;
  line-height: 1.4;
  color: var(--cw-gray-500, #6b7280);
  padding: 0 12px 8px;
  margin: 0;
  text-align: center;
}
.cw-lead-form p.cw-legal-note {
  padding: 0;
  margin: 0 0 8px;
  text-align: left;
}
.cw-legal-note a {
  color: inherit;
  text-decoration: underline;
}
.cw-lead-form input {
  display: block;
  width: 100%;
  padding: 7px 12px;
  margin-bottom: 8px;
  border: 1.5px solid var(--cw-gray-200);
  border-radius: 6px;
  font-family: var(--cw-font);
  font-size: 13px;
  outline: none;
  box-sizing: border-box;
  transition: border-color .15s;
}
.cw-lead-form input:focus {
  border-color: var(--brand-primary);
}
.cw-lead-form-actions {
  display: flex;
  gap: 8px;
}
.cw-lead-form-submit {
  flex: 1;
  padding: 8px 12px;
  background: var(--brand-cta-dark);
  color: var(--brand-on-cta, #fff);
  font-family: var(--cw-font);
  font-size: 13px;
  font-weight: 600;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background .15s;
}
.cw-lead-form-submit:hover { filter: brightness(.9); }
.cw-msg-form { max-width: 100%; }
.cw-lead-form-submit:disabled {
  opacity: .5;
  cursor: not-allowed;
}
.cw-lead-form-dismiss {
  padding: 8px 12px;
  background: transparent;
  color: var(--cw-gray-500);
  font-family: var(--cw-font);
  font-size: 13px;
  border: 1.5px solid var(--cw-gray-300);
  border-radius: 6px;
  cursor: pointer;
  transition: background .15s;
}
.cw-lead-form-dismiss:hover { background: var(--cw-gray-100); }

.cw-lead-success {
  padding: 10px 14px;
  background: #d1fae5;
  color: #065f46;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--cw-radius-sm);
  text-align: center;
}

/* ---------- Expanded (js/chat-expand.js) ---------- */
.cw-panel[data-chat-size="expanded"] {
  left: 0;
  right: 0;
  top: 7.5vh;
  top: 7.5dvh;
  bottom: auto;
  margin: 0 auto;
  width: min(960px, calc(100vw - 32px));
  height: 85vh;
  height: 85dvh;
  max-height: none;
  /* The page behind is dimmed by the shadow only: on a desktop it stays usable (no focus trap). */
  box-shadow: var(--cw-shadow), 0 0 0 100vmax rgba(17, 24, 39, .35);
}
.cw-panel[data-chat-size="expanded"] .cw-messages {
  max-height: none;
  min-height: 0;
  flex: 1 1 auto;
  padding: 18px 24px 10px;
}
.cw-panel[data-chat-size="expanded"] .cw-msg {
  max-width: min(82%, 70ch);
  font-size: 15px;
}
.cw-panel[data-chat-size="expanded"] .cw-msg-form { max-width: min(100%, 70ch); }
.cw-panel[data-chat-size="expanded"] ~ .cw-fab { display: none; }

@media (max-width: 600px) {
  /* On a phone, «expanded» is the full screen; the page behind is inert and does not scroll. */
  .cw-panel[data-chat-size="expanded"] {
    inset: 0;
    top: 0;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    margin: 0;
    border-radius: 0;
    box-shadow: none;
    box-sizing: border-box;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  }
  .cw-panel[data-chat-size="expanded"] .cw-messages { padding: 14px 14px 8px; }
  .cw-panel[data-chat-size="expanded"] .cw-msg { max-width: 88%; }
  .cw-panel[data-chat-size="expanded"] .cw-hdr-wide { display: none; }
  .cw-panel[data-chat-size="expanded"] .cw-hdr-narrow { display: inline-flex; }
}

@media (prefers-reduced-motion: reduce) {
  .cw-panel, .cw-fab, .cw-icon-btn, .cw-chip, .cw-pill-link, .cw-calculator-link, .cw-send-btn {
    transition: none !important;
  }
  .cw-fab.cw-pulse { animation: none; }
  .cw-msg-ai p, .cw-msg-ai li, .cw-msg-ai strong, .cw-msg-ai em { animation: none; }
}

/* ---------- Responsive: mobile ---------- */
@media (max-width: 480px) {
  .cw-panel {
    width: calc(100vw - 16px);
    right: 8px;
    bottom: 80px;
    max-height: 70vh;
  }
  .cw-messages {
    max-height: calc(70vh - 180px);
  }
  .cw-fab {
    bottom: 14px;
    right: 14px;
  }
}

/* ==========================================================================
   Help Desk Page — /ayuda/
   ========================================================================== */

.helpdesk-container {
  max-width: 960px;
  margin: 0 auto;
  padding: 40px 20px;
  font-family: var(--cw-font);
}
.helpdesk-container h1 {
  font-size: 28px;
  font-weight: 700;
  color: var(--cw-navy);
  margin-bottom: 8px;
}
.helpdesk-container > p {
  font-size: 16px;
  color: var(--cw-gray-500);
  margin-bottom: 32px;
}

/* Question cards grid */
.helpdesk-questions {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  margin-bottom: 40px;
}
.helpdesk-questions .hd-card {
  background: var(--cw-white);
  border: 1.5px solid var(--cw-gray-200);
  border-radius: var(--cw-radius-sm);
  padding: 18px 20px;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}
.helpdesk-questions .hd-card:hover {
  border-color: var(--cw-teal);
  box-shadow: 0 2px 12px rgba(8, 145, 178, .12);
}
.helpdesk-questions .hd-card h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--cw-navy);
  margin: 0 0 4px;
}
.helpdesk-questions .hd-card p {
  font-size: 13px;
  color: var(--cw-gray-500);
  margin: 0;
}

/* Full-height embedded chat for help desk */
.helpdesk-chat {
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  background: var(--cw-white);
  border-radius: var(--cw-radius);
  box-shadow: var(--cw-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 480px;
  max-height: 640px;
}
.helpdesk-chat .cw-header {
  border-radius: var(--cw-radius) var(--cw-radius) 0 0;
}
.helpdesk-chat .cw-messages {
  max-height: none;
  flex: 1;
}
.helpdesk-chat .cw-header-close { display: none; }

@media (max-width: 600px) {
  .helpdesk-questions {
    grid-template-columns: 1fr;
  }
  .helpdesk-chat {
    max-height: 70vh;
  }
}
