/* Hermes webchat widget. Each site maps its own colours onto these variables, e.g. .wc { --wc-accent: var(--accent); }
   The defaults sit in :where() (no specificity), so a site's .wc rule wins whatever the stylesheet order. */
:where(.wc) {
  --wc-accent: #1E5AA8;
  --wc-accent-contrast: #FFFFFF;
  --wc-ink: #14203A;
  --wc-muted: #4B5670;
  --wc-bg: #F5F7FC;
  --wc-panel: #FFFFFF;
  --wc-line: #E2E6F0;
  --wc-input: #B6BFD3;
  --wc-ok: #1F8A5B;
  --wc-bad: #B3261E;
  --wc-radius: 14px;
  --wc-font: inherit;
  --wc-bottom: 16px;
  --wc-side: 16px;
  --wc-z: 60;
}
.wc { font-family: var(--wc-font); color: var(--wc-ink); }
.wc *, .wc *::before, .wc *::after { box-sizing: border-box; }
.wc [hidden] { display: none !important; }
.wc-sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Launcher */
.wc-launcher {
  position: fixed; z-index: var(--wc-z); bottom: calc(var(--wc-bottom) + env(safe-area-inset-bottom, 0px)); inset-inline-end: var(--wc-side);
  display: inline-flex; align-items: center; gap: 10px; min-height: 56px; padding: 0 20px 0 16px;
  border: 0; border-radius: 999px; background: var(--wc-accent); color: var(--wc-accent-contrast);
  font: inherit; font-size: 16px; font-weight: 700; cursor: pointer; box-shadow: 0 8px 24px rgba(10, 20, 45, .28);
  transition: transform .15s ease, bottom .2s ease;
}
.wc-launcher:hover { transform: translateY(-1px); }
.wc-launcher:focus-visible, .wc button:focus-visible, .wc a:focus-visible, .wc input:focus-visible, .wc select:focus-visible, .wc textarea:focus-visible { outline: 3px solid var(--wc-accent); outline-offset: 2px; }
.wc-launcher:focus-visible { outline-color: var(--wc-ink); }
.wc-badge { position: absolute; top: -4px; inset-inline-end: -4px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: var(--wc-bad); color: #FFF; font-size: 13px; line-height: 22px; text-align: center; }

/* Panel: a card on desktop, the full screen on phones */
.wc-panel {
  position: fixed; z-index: calc(var(--wc-z) + 1); bottom: calc(var(--wc-bottom) + env(safe-area-inset-bottom, 0px)); inset-inline-end: var(--wc-side);
  width: min(400px, calc(100vw - 2 * var(--wc-side))); height: min(640px, calc(100vh - 2 * var(--wc-bottom))); height: min(640px, calc(100dvh - 2 * var(--wc-bottom)));
  display: flex; flex-direction: column; background: var(--wc-panel); border: 1px solid var(--wc-line); border-radius: calc(var(--wc-radius) + 4px);
  box-shadow: 0 24px 60px rgba(10, 20, 45, .3); overflow: hidden; font-size: 15px; line-height: 1.5;
}
.wc-is-open .wc-launcher { display: none; }
.wc-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 14px 12px 14px 18px; background: var(--wc-accent); color: var(--wc-accent-contrast); }
[dir="rtl"] .wc-head { padding: 14px 18px 14px 12px; }
.wc-title { margin: 0; font-size: 18px; font-weight: 800; line-height: 1.3; color: inherit; }
.wc-status { margin: 2px 0 0; display: flex; align-items: center; gap: 8px; font-size: 13px; opacity: .92; }
.wc-dot { width: 9px; height: 9px; border-radius: 999px; background: #C9CED8; flex: none; }
.wc-online .wc-dot { background: #4ADE80; box-shadow: 0 0 0 3px rgba(74, 222, 128, .25); }
.wc-icon { flex: none; width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 999px; background: transparent; color: inherit; cursor: pointer; }
.wc-icon:hover { background: rgba(255, 255, 255, .15); }

.wc-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.wc-form { overflow-y: auto; padding: 16px 18px 18px; gap: 12px; }
.wc-intro, .wc-note, .wc-hint, .wc-small { margin: 0; color: var(--wc-muted); }
.wc-note { background: #FFF4E0; border: 1px solid #F2D49B; color: #5A3E00; border-radius: var(--wc-radius); padding: 10px 12px; }
.wc-hint, .wc-small { font-size: 13px; }
.wc-alert { margin: 0; background: #FDECEC; border: 1px solid #F2C2BE; color: var(--wc-bad); border-radius: var(--wc-radius); padding: 10px 12px; font-weight: 600; }
.wc-field { display: flex; flex-direction: column; gap: 5px; font-size: 14px; font-weight: 600; }
.wc-opt { font-weight: 500; color: var(--wc-muted); }
.wc-field input, .wc-field select, .wc-field textarea, .wc-composer textarea {
  font: inherit; font-size: 16px; font-weight: 500; color: var(--wc-ink); background: #FFF; width: 100%; max-width: 100%;
  border: 1px solid var(--wc-input); border-radius: calc(var(--wc-radius) - 2px); padding: 11px 12px; min-height: 46px;
}
.wc-field textarea { resize: vertical; min-height: 84px; }
.wc [aria-invalid="true"] { border-color: var(--wc-bad) !important; }
.wc-error { font-size: 13px; font-weight: 600; color: var(--wc-bad); }
.wc-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.wc-primary { font: inherit; font-weight: 800; font-size: 16px; min-height: 50px; padding: 0 20px; border: 0; border-radius: 999px; background: var(--wc-accent); color: var(--wc-accent-contrast); cursor: pointer; }
.wc-primary:disabled { opacity: .6; cursor: wait; }
.wc-files { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.wc-attach { position: relative; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; color: var(--wc-accent); font-weight: 700; font-size: 14px; cursor: pointer; }
.wc-attach input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.wc-file-names { font-size: 13px; color: var(--wc-muted); overflow-wrap: anywhere; }

/* Conversation */
.wc-chat { background: var(--wc-bg); }
.wc-messages { flex: 1; min-height: 0; overflow-y: auto; margin: 0; padding: 16px 14px 8px; list-style: none; display: flex; flex-direction: column; gap: 10px; overscroll-behavior: contain; }
.wc-msg { max-width: 84%; padding: 9px 12px 6px; border-radius: 16px; background: var(--wc-panel); border: 1px solid var(--wc-line); align-self: flex-start; overflow-wrap: anywhere; }
.wc-visitor { align-self: flex-end; background: var(--wc-accent); color: var(--wc-accent-contrast); border-color: transparent; border-end-end-radius: 4px; }
.wc-staff { border-end-start-radius: 4px; }
.wc-system { align-self: center; max-width: 92%; background: transparent; border: 0; text-align: center; color: var(--wc-muted); font-size: 13px; padding: 2px 8px; }
.wc-who { display: block; font-size: 12px; font-weight: 700; color: var(--wc-muted); }
.wc-text { margin: 0; white-space: pre-wrap; }
.wc-file { display: block; margin-top: 4px; font-weight: 700; color: inherit; text-decoration: underline; padding: 6px 0; }
.wc-meta { display: block; margin-top: 2px; font-size: 12px; opacity: .75; text-align: end; }
.wc-system .wc-meta { display: none; }
.wc-read::before { content: " · "; }
.wc-pending { opacity: .7; }
.wc-failed { opacity: 1; background: #FDECEC; color: var(--wc-bad); border: 1px solid #F2C2BE; cursor: pointer; }
.wc-typing { margin: 0; padding: 0 16px 6px; font-size: 13px; color: var(--wc-muted); font-style: italic; }
.wc-chat > .wc-alert { margin: 0 12px 8px; }
.wc-done { padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; background: var(--wc-panel); border-top: 1px solid var(--wc-line); }
.wc-done p { margin: 0; color: var(--wc-muted); }
.wc-composer { display: flex; align-items: flex-end; gap: 6px; padding: 10px 10px 4px; background: var(--wc-panel); border-top: 1px solid var(--wc-line); }
.wc-composer textarea { flex: 1; min-height: 44px; max-height: 140px; resize: none; border-radius: 22px; padding: 10px 14px; }
.wc-attach-icon { width: 44px; height: 44px; justify-content: center; flex: none; }
.wc-send { flex: none; width: 44px; height: 44px; border: 0; border-radius: 999px; background: var(--wc-accent); color: var(--wc-accent-contrast); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
[dir="rtl"] .wc-send svg { transform: scaleX(-1); }
.wc-composer-files { margin: 0; padding: 0 16px; background: var(--wc-panel); }
.wc-end { align-self: center; font: inherit; font-size: 13px; font-weight: 600; color: var(--wc-muted); background: var(--wc-panel); border: 0; width: 100%; min-height: 40px; text-decoration: underline; cursor: pointer; padding-bottom: env(safe-area-inset-bottom, 0px); }

/* Phones: a round button, the window over the full screen */
@media (max-width: 560px) {
  .wc-launcher { width: 56px; height: 56px; padding: 0; justify-content: center; }
  .wc-launcher-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .wc-panel { inset: 0; width: 100%; height: 100%; border-radius: 0; border: 0; }
  html.wc-open, html.wc-open body { overflow: hidden; }
}
@media (prefers-reduced-motion: reduce) { .wc-launcher { transition: none; } }
