:root {
  --ac-accent:      #e63946;
  --ac-bg:          #1a1a2e;
  --ac-bg-surface:  #16213e;
  --ac-bg-message:  #0f3460;
  --ac-text:        #e0e0e0;
  --ac-text-muted:  #9a9ab0;
  --ac-bubble-size: 56px;
  --ac-radius:      14px;
  --ac-shadow:      0 8px 32px rgba(0, 0, 0, 0.5);
}

/* ── Launcher pill (icon + text inside red pill) ── */
#andcards-chatbot-launcher {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 99999;
  height: var(--ac-bubble-size);
  padding: 0 18px 0 20px;
  border-radius: calc(var(--ac-bubble-size) / 2);
  background: var(--ac-accent);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--ac-shadow);
  transition: transform 0.2s ease, background 0.2s ease, padding 0.2s ease;
  font-family: inherit;
}
#andcards-chatbot-launcher:hover { transform: scale(1.04); background: #ff4d5a; }
#andcards-chatbot-launcher svg { width: 24px; height: 24px; fill: #fff; pointer-events: none; flex-shrink: 0; }
#andcards-chatbot-launcher .ac-launcher-text {
  color: #fff;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.01em;
  white-space: nowrap;
  pointer-events: none;
}
#andcards-chatbot-launcher .ac-close-icon { display: none; }
#andcards-chatbot-launcher.is-open {
  width: var(--ac-bubble-size);
  padding: 0;
  justify-content: center;
  border-radius: 50%;
}
#andcards-chatbot-launcher.is-open .ac-chat-icon,
#andcards-chatbot-launcher.is-open .ac-launcher-text { display: none; }
#andcards-chatbot-launcher.is-open .ac-close-icon { display: block; }

/* ac-holder fastholder pillens form i 450 ms efter et klik, saa en
   administrators klik nummer to rammer knappen og bliver til et dobbeltklik.
   Uden den krymper knappen til en cirkel med det samme, og klik nummer to
   lander ved siden af. */
#andcards-chatbot-launcher.is-open.ac-holder { width: auto; padding: 0 18px 0 20px; border-radius: calc(var(--ac-bubble-size) / 2); }
#andcards-chatbot-launcher.is-open.ac-holder .ac-chat-icon { display: block; }
#andcards-chatbot-launcher.is-open.ac-holder .ac-launcher-text { display: inline; }
#andcards-chatbot-launcher.is-open.ac-holder .ac-close-icon { display: none; }

/* ── Chat window ── */
#andcards-chatbot-window {
  position: fixed;
  bottom: calc(var(--ac-bubble-size) + 36px);
  right: 24px;
  z-index: 99998;
  width: 360px;
  max-width: calc(100vw - 32px);
  height: 520px;
  max-height: calc(100vh - 120px);
  display: flex;
  flex-direction: column;
  background: var(--ac-bg);
  border-radius: var(--ac-radius);
  box-shadow: var(--ac-shadow);
  overflow: hidden;
  opacity: 0;
  transform: translateY(12px) scale(0.97);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
#andcards-chatbot-window.is-visible { opacity: 1; transform: translateY(0) scale(1); pointer-events: all; }

/* ── Header (two rows: identity + actions) ── */
.ac-header {
  display: flex; flex-direction: column; gap: 8px;
  padding: 12px 14px 10px; background: var(--ac-bg-surface);
  border-bottom: 1px solid rgba(255,255,255,0.06); flex-shrink: 0;
}
.ac-header-identity {
  display: flex; align-items: center; gap: 10px;
}
.ac-header-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--ac-accent); display: flex;
  align-items: center; justify-content: center;
  font-size: 16px; flex-shrink: 0;
}
.ac-header-info { flex: 1; min-width: 0; }
.ac-header-name {
  font-size: 14px; font-weight: 600; color: #fff; line-height: 1.2;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  white-space: nowrap;
}
.ac-header-status {
  font-size: 11px; color: #4caf50;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.ac-header-actions {
  display: flex; align-items: center; gap: 6px; flex-shrink: 0;
  margin-left: 42px; /* Align under the name (avatar width + gap). */
}
.ac-header-btn {
  display: flex; align-items: center; gap: 5px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  padding: 5px 10px 5px 8px;
  cursor: pointer;
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 11px; font-weight: 500;
  line-height: 1;
  transition: background 0.15s, transform 0.15s;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.ac-header-btn:hover { background: rgba(255,255,255,0.18); transform: translateY(-1px); }
.ac-header-btn svg { width: 12px; height: 12px; fill: #fff; flex-shrink: 0; }

/* ── Sessions panel ── */
.ac-sessions-panel {
  flex: 1; overflow-y: auto;
}
.ac-sessions-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid rgba(255,255,255,0.06);
  font-size: 13px; font-weight: 600; color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.ac-sessions-back {
  background: none; border: none; color: var(--ac-accent); cursor: pointer;
  font-size: 12.5px; font-family: inherit; padding: 4px 8px; border-radius: 6px;
}
.ac-sessions-back:hover { background: rgba(255,255,255,0.06); }
.ac-sessions-list { padding: 8px; display: flex; flex-direction: column; gap: 4px; overflow-y: auto; }
.ac-sessions-empty {
  color: var(--ac-text-muted); font-size: 13px; text-align: center; padding: 24px 16px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.ac-session-item {
  display: flex; flex-direction: column; gap: 2px;
  background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.06);
  border-radius: 8px; padding: 10px 12px; cursor: pointer;
  text-align: left; transition: background 0.15s;
}
.ac-session-item:hover { background: rgba(255,255,255,0.08); }
.ac-session-preview {
  font-size: 13px; color: var(--ac-text); line-height: 1.3;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.ac-session-meta {
  font-size: 11px; color: var(--ac-text-muted);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ── Messages ── */
.ac-messages {
  flex: 1; overflow-y: auto; padding: 16px;
  display: flex; flex-direction: column; gap: 10px; scroll-behavior: smooth;
}
.ac-messages::-webkit-scrollbar { width: 4px; }
.ac-messages::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 2px; }
.ac-message {
  max-width: 82%; padding: 10px 13px; border-radius: 12px;
  font-size: 13.5px; line-height: 1.5;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  word-break: break-word; white-space: pre-wrap;
}
.ac-message.ac-user {
  align-self: flex-end; background: var(--ac-accent);
  color: #fff; border-bottom-right-radius: 3px;
}
.ac-message.ac-assistant {
  align-self: flex-start; background: var(--ac-bg-message);
  color: var(--ac-text); border-bottom-left-radius: 3px;
}
.ac-link-btn {
  display: inline-block;
  margin: 4px 4px 4px 0;
  padding: 6px 14px;
  background: var(--ac-accent);
  color: #fff;
  font-size: 12.5px;
  font-weight: 600;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  border-radius: 8px;
  text-decoration: none;
  transition: background 0.15s, transform 0.15s;
}
.ac-link-btn:hover { background: #ff4d5a; transform: scale(1.04); }

/* ── Typing indicator ── */
.ac-typing {
  align-self: flex-start; background: var(--ac-bg-message);
  border-radius: 12px; border-bottom-left-radius: 3px;
  padding: 12px 16px; display: flex; gap: 5px; align-items: center;
}
.ac-typing span {
  width: 7px; height: 7px; background: var(--ac-text-muted);
  border-radius: 50%; animation: ac-bounce 1.2s infinite ease-in-out;
}
.ac-typing span:nth-child(2) { animation-delay: 0.15s; }
.ac-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes ac-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.6; }
  30%            { transform: translateY(-5px); opacity: 1; }
}

/* ── Input area ── */
.ac-input-area {
  display: flex; align-items: flex-end; gap: 8px;
  padding: 12px 12px 14px; background: var(--ac-bg-surface);
  border-top: 1px solid rgba(255,255,255,0.06); flex-shrink: 0;
}
.ac-input {
  flex: 1; background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.12); border-radius: 10px;
  padding: 9px 12px; color: var(--ac-text);
  font-size: 16px !important; /* 16px prevents iOS Safari auto-zoom on focus */
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  resize: none; outline: none; line-height: 1.4;
  max-height: 100px; overflow-y: auto; transition: border-color 0.15s;
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
}
.ac-input::placeholder { color: var(--ac-text-muted); }
.ac-input:focus { border-color: var(--ac-accent); }
.ac-send-btn {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--ac-accent); border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: background 0.15s, transform 0.15s;
}
.ac-send-btn:hover:not(:disabled) { background: #ff4d5a; transform: scale(1.06); }
.ac-send-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.ac-send-btn svg { width: 16px; height: 16px; fill: #fff; }

/* ── Gæste-cap banner ── */
.ac-guest-limit {
  font-size: 12px; color: var(--ac-text-muted); text-align: center;
  padding: 6px 12px; background: rgba(255,255,255,0.04);
  border-top: 1px solid rgba(255,255,255,0.06);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.ac-guest-limit a { color: var(--ac-accent); text-decoration: none; }
.ac-guest-limit a:hover { text-decoration: underline; }
.ac-guest-limit.ac-limit-reached { color: #ff6b6b; font-weight: 600; }

/* ── PIN gate ── */
.ac-pin-gate {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 32px 24px; text-align: center; gap: 10px;
}
.ac-pin-gate-logo { font-size: 40px; line-height: 1; margin-bottom: 4px; }
.ac-pin-gate-title {
  font-size: 17px; font-weight: 700; color: #fff;
  line-height: 1.4; margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.ac-pin-gate-sub {
  font-size: 12.5px; color: var(--ac-text-muted); margin: 0 0 8px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; line-height: 1.5;
}
.ac-pin-row { display: flex; gap: 8px; width: 100%; max-width: 220px; }
.ac-pin-input {
  flex: 1; background: rgba(255,255,255,0.07); border: 1px solid rgba(255,255,255,0.15);
  border-radius: 10px; padding: 9px 12px; color: var(--ac-text);
  font-size: 16px !important; /* 16px prevents iOS Safari auto-zoom on focus */
  letter-spacing: 0.15em;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  outline: none; text-align: center; transition: border-color 0.15s;
  touch-action: manipulation;
}
.ac-pin-input:focus { border-color: var(--ac-accent); }
.ac-pin-submit {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--ac-accent); border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: background 0.15s, transform 0.15s;
}
.ac-pin-submit:hover:not(:disabled) { background: #ff4d5a; transform: scale(1.06); }
.ac-pin-submit:disabled { opacity: 0.4; cursor: not-allowed; }
.ac-pin-submit svg { width: 15px; height: 15px; fill: #fff; }
.ac-pin-error {
  font-size: 12px; color: #ff6b6b; min-height: 16px; margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ── Error message ── */
.ac-error {
  font-size: 12px; color: #ff6b6b; padding: 0 16px 8px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ── Naar minikurven (Flatsomes off-canvas) er aaben ──
   Kurven er 360 px bred i hoejre side, og knappen laa oven paa dens bund -
   lige hvor "Til kassen" sidder. PC og tablet: knappen bliver en lille
   cirkel til venstre for kurven. Telefon: kurven fylder naesten hele
   bredden, saa knappen og chatvinduet gemmes, til kurven lukkes igen. */
#andcards-chatbot-launcher { transition: transform 0.2s ease, background 0.2s ease, padding 0.2s ease, right 0.25s ease, opacity 0.2s ease; }
html.has-off-canvas-right #andcards-chatbot-launcher {
  right: 384px;
  width: var(--ac-bubble-size);
  padding: 0;
  justify-content: center;
  border-radius: 50%;
}
html.has-off-canvas-right #andcards-chatbot-launcher .ac-launcher-text { display: none; }
html.has-off-canvas-right #andcards-chatbot-launcher::before { display: none !important; }
html.has-off-canvas #andcards-chatbot-window { visibility: hidden; opacity: 0; pointer-events: none; }
@media (max-width: 549px) {
  html.has-off-canvas #andcards-chatbot-launcher { visibility: hidden; opacity: 0; pointer-events: none; }
}

/* ── Mobile ── */
@media (max-width: 480px) {
  #andcards-chatbot-window {
    right: 8px; bottom: calc(var(--ac-bubble-size) + 20px);
    width: calc(100vw - 16px); height: 70vh;
  }
  #andcards-chatbot-launcher { bottom: 16px; right: 16px; padding: 0 16px 0 14px; }
  #andcards-chatbot-launcher .ac-launcher-text { font-size: 13px; }
}