/* Floating AI help assistant. Works on the app (styles.css tokens) and the site (site.css tokens). */
.as-root {
  --as-accent: var(--accent, #4A6B4F); --as-on: var(--on-accent, #fff); --as-soft: var(--accent-soft, #E3EADF);
  --as-bg: var(--surface, #fff); --as-bg2: var(--surface-2, var(--soft, #EFEAE1)); --as-text: var(--text, #2A2622);
  --as-muted: var(--text-muted, var(--muted, #6B6259)); --as-line: var(--border, var(--line, #E2DBCF)); --as-danger: var(--danger, #A4483A);
  font-family: var(--ui, 'Heebo', system-ui, sans-serif);
}
.as-fab {
  position: fixed; z-index: 70; inset-inline-end: 16px; bottom: calc(var(--as-offset, 20px) + env(safe-area-inset-bottom));
  width: 56px; height: 56px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--as-accent); color: var(--as-on); display: grid; place-items: center;
  box-shadow: 0 10px 28px -10px rgba(0,0,0,.45); transition: transform .2s cubic-bezier(.2,.8,.2,1);
}
.as-fab:hover { transform: scale(1.05); }
.as-fab:focus-visible { outline: 3px solid var(--as-soft); outline-offset: 3px; }
.as-fab[aria-expanded="true"] { transform: scale(.9); }
.as-panel {
  position: fixed; z-index: 71; inset-inline-end: 16px; bottom: calc(var(--as-offset, 20px) + 68px + env(safe-area-inset-bottom));
  width: min(380px, calc(100vw - 32px)); height: min(560px, calc(100vh - var(--as-offset, 20px) - 110px));
  background: var(--as-bg); color: var(--as-text); border: 1px solid var(--as-line); border-radius: 22px;
  box-shadow: 0 24px 60px -20px rgba(0,0,0,.4); display: flex; flex-direction: column; overflow: hidden;
  transform-origin: bottom; animation: as-in .22s cubic-bezier(.2,.8,.2,1);
}
.as-panel[hidden] { display: none; }
@keyframes as-in { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
.as-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--as-line); }
.as-head .as-av { width: 36px; height: 36px; border-radius: 12px; background: var(--as-soft); color: var(--as-accent); display: grid; place-items: center; flex: none; }
.as-head b { display: block; font-size: 15px; }
.as-head small { display: block; font-size: 12px; color: var(--as-muted); }
.as-x { margin-inline-start: auto; width: 34px; height: 34px; border-radius: 50%; border: 0; background: none; color: var(--as-text); cursor: pointer; display: grid; place-items: center; }
.as-x:hover { background: var(--as-bg2); }
.as-log { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.as-msg { max-width: 86%; padding: 9px 13px; border-radius: 16px; font-size: 14.5px; line-height: 1.5; white-space: pre-wrap; word-wrap: break-word; }
.as-msg.bot { align-self: flex-start; background: var(--as-bg2); border-start-start-radius: 4px; }
.as-msg.me { align-self: flex-end; background: var(--as-accent); color: var(--as-on); border-start-end-radius: 4px; }
.as-msg a { color: inherit; }
.as-sugg { display: flex; flex-wrap: wrap; gap: 6px; }
.as-sugg button, .as-offer button, .as-link {
  font: inherit; font-size: 13px; padding: 7px 12px; border-radius: 99px; border: 1px solid var(--as-line);
  background: var(--as-bg); color: var(--as-text); cursor: pointer;
}
.as-sugg button:hover { border-color: var(--as-accent); }
.as-offer { align-self: flex-start; max-width: 90%; font-size: 13.5px; color: var(--as-muted); display: grid; gap: 8px; }
.as-offer button { background: var(--as-soft); color: var(--as-accent); border-color: transparent; font-weight: 500; justify-self: start; }
.as-typing { align-self: flex-start; display: flex; gap: 4px; padding: 12px 14px; background: var(--as-bg2); border-radius: 16px; }
.as-typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--as-muted); animation: as-blink 1.2s infinite; }
.as-typing i:nth-child(2) { animation-delay: .2s; } .as-typing i:nth-child(3) { animation-delay: .4s; }
@keyframes as-blink { 0%, 80%, 100% { opacity: .3; } 40% { opacity: 1; } }
.as-form { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--as-line); }
.as-form input, .as-contact input, .as-contact textarea {
  flex: 1; min-width: 0; font: inherit; font-size: 15px; color: var(--as-text); background: var(--as-bg);
  border: 1px solid var(--as-line); border-radius: 12px; padding: 10px 12px; outline: 0;
}
.as-form input { border-radius: 99px; }
.as-form input:focus, .as-contact input:focus, .as-contact textarea:focus { border-color: var(--as-accent); box-shadow: 0 0 0 3px var(--as-soft); }
.as-send { width: 42px; height: 42px; border-radius: 50%; border: 0; background: var(--as-accent); color: var(--as-on); display: grid; place-items: center; cursor: pointer; flex: none; }
.as-send:disabled { opacity: .5; cursor: default; }
[dir="rtl"] .as-send svg { transform: scaleX(-1); }
.as-foot { font-size: 11.5px; color: var(--as-muted); text-align: center; padding: 0 12px 8px; }
.as-contact { flex: 1; overflow-y: auto; padding: 16px; display: grid; gap: 10px; align-content: start; }
.as-contact label { font-size: 13px; font-weight: 500; display: grid; gap: 4px; }
.as-contact textarea { min-height: 110px; resize: vertical; }
.as-contact .as-primary { font: inherit; font-weight: 500; padding: 11px; border-radius: 99px; border: 0; background: var(--as-accent); color: var(--as-on); cursor: pointer; }
.as-contact .as-note { font-size: 13px; color: var(--as-muted); }
.as-contact .as-err { font-size: 13px; color: var(--as-danger); }
.as-contact .as-ok { font-size: 15px; background: var(--as-soft); color: var(--as-accent); padding: 12px 14px; border-radius: 12px; }
@media (prefers-reduced-motion: reduce) { .as-panel, .as-fab { animation: none; transition: none; } .as-typing i { animation: none; } }
@media (max-width: 480px) {
  .as-panel { inset-inline: 8px; width: auto; bottom: calc(var(--as-offset, 20px) + 64px + env(safe-area-inset-bottom)); height: min(70vh, calc(100vh - var(--as-offset, 20px) - 100px)); }
}
/* Own messages on the right in both directions, like the app's chat */
[dir="rtl"] .as-msg.me { align-self: flex-start; border-radius: 16px; border-start-start-radius: 4px; }
[dir="rtl"] .as-msg.bot { align-self: flex-end; border-radius: 16px; border-start-end-radius: 4px; }
[dir="rtl"] .as-offer { align-self: flex-end; }
