/* "Ask about Amy" chat panel. Shared by / (internal) and /client/ (Eastex).
   Everything is namespaced ask-; colours copy the client page so both pages look the same. */
.ask-root {
  --ask-bg: #FBF8F2; --ask-bg2: #F3EEE4; --ask-card: #FFFFFF; --ask-ink: #1D2622; --ask-ink2: #3C4842; --ask-muted: #5E6A64;
  --ask-line: #E4DDCF; --ask-line2: #CFC6B4; --ask-green: #1F5E4B; --ask-green-soft: #E3EFE9; --ask-red: #B3322F; --ask-red-soft: #FBE9E7;
  --ask-font: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --ask-serif: 'Fraunces', 'Iowan Old Style', Georgia, serif;
  --ask-r: 14px;
  --ask-shadow: 0 1px 2px rgba(30,30,20,.06), 0 12px 32px rgba(30,30,20,.16);
  font: 15px/1.5 var(--ask-font); color: var(--ask-ink); -webkit-font-smoothing: antialiased;
}
.ask-root *, .ask-root *::before, .ask-root *::after { box-sizing: border-box; }

/* floating button */
.ask-fab {
  position: fixed; z-index: 40; right: 20px; bottom: 20px; right: max(20px, env(safe-area-inset-right));
  display: inline-flex; align-items: center; gap: 8px; height: 46px; padding: 0 18px 0 14px;
  border: 0; border-radius: 999px; background: var(--ask-green); color: #fff; font: 600 14.5px/1 var(--ask-font);
  cursor: pointer; box-shadow: 0 8px 24px rgba(31,94,75,.32); transition: transform .15s, box-shadow .15s;
}
.ask-fab:hover { transform: translateY(-1px); box-shadow: 0 10px 28px rgba(31,94,75,.4); }
.ask-fab:focus-visible { outline: 3px solid #8CC1AE; outline-offset: 2px; }
.ask-fab svg { width: 18px; height: 18px; flex: none; }
.ask-fab[hidden] { display: none !important; }
/* internal chart: right side holds the minimap, zoom and detail panel, so the button sits bottom-left above the legend */
.ask-fab.ask-left { right: auto; left: 16px; bottom: var(--ask-left-bottom, 16px); }
/* on phones the chart's detail and play panels are bottom sheets: get out of their way */
@media (max-width: 860px) { body.gaming .ask-fab.ask-left, body.paneling .ask-fab.ask-left { display: none; } }
body.doc-open .ask-fab, body.doc-open .ask-panel { display: none; }

/* panel */
.ask-panel {
  position: fixed; z-index: 1000; top: 12px; right: 12px; bottom: 12px; width: 380px; max-width: calc(100vw - 24px);
  display: flex; flex-direction: column; background: var(--ask-bg); border: 1px solid var(--ask-line); border-radius: 18px;
  box-shadow: var(--ask-shadow); overflow: hidden;
  transform: translateX(calc(100% + 24px)); visibility: hidden; transition: transform .28s cubic-bezier(.2,.8,.2,1), visibility 0s .28s;
}
.ask-panel.ask-open { transform: none; visibility: visible; transition: transform .28s cubic-bezier(.2,.8,.2,1); }
.ask-head { flex: none; padding: 14px 14px 12px 18px; border-bottom: 1px solid var(--ask-line); background: var(--ask-bg2); }
.ask-head-row { display: flex; align-items: center; gap: 10px; }
.ask-title { flex: 1; margin: 0; font: 600 19px/1.2 var(--ask-serif); letter-spacing: -.01em; color: var(--ask-ink); }
.ask-note { margin: 4px 0 0; font-size: 12.5px; color: var(--ask-muted); }
.ask-x { flex: none; width: 34px; height: 34px; border: 0; border-radius: 10px; background: transparent; color: var(--ask-ink2); cursor: pointer; display: grid; place-items: center; }
.ask-x:hover { background: rgba(0,0,0,.06); }
.ask-x svg { width: 18px; height: 18px; }

.ask-body { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 16px 8px; overscroll-behavior: contain; }
.ask-chips { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.ask-chips-l { font: 600 11.5px/1 var(--ask-font); letter-spacing: .07em; text-transform: uppercase; color: var(--ask-muted); margin-bottom: 2px; }
.ask-chip { text-align: left; font: 500 14px/1.35 var(--ask-font); color: var(--ask-green); background: var(--ask-card); border: 1px solid var(--ask-line);
  border-radius: 12px; padding: 9px 12px; cursor: pointer; }
.ask-chip:hover { border-color: var(--ask-green); background: var(--ask-green-soft); }
.ask-chip:disabled { opacity: .55; cursor: default; }

.ask-msg { max-width: 92%; margin: 0 0 10px; padding: 10px 13px; border-radius: 14px; font-size: 14.5px; line-height: 1.5; overflow-wrap: anywhere; }
.ask-msg p { margin: 0; }
.ask-msg p + p, .ask-msg p + ul, .ask-msg ul + p, .ask-msg ol + p, .ask-msg p + ol { margin-top: 6px; }
.ask-msg ul, .ask-msg ol { margin: 0; padding-left: 20px; }
.ask-msg li + li { margin-top: 3px; }
.ask-user { margin-left: auto; background: var(--ask-green); color: #fff; border-bottom-right-radius: 5px; white-space: pre-wrap; }
.ask-bot { background: var(--ask-card); border: 1px solid var(--ask-line); border-bottom-left-radius: 5px; color: var(--ask-ink); }
.ask-err { background: var(--ask-red-soft); border: 1px solid #F0C9C5; color: var(--ask-red); font-size: 13.5px; }
.ask-typing { display: inline-flex; gap: 4px; align-items: center; padding: 13px 14px; }
.ask-typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--ask-line2); animation: ask-b 1.1s infinite ease-in-out; }
.ask-typing i:nth-child(2) { animation-delay: .15s; } .ask-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes ask-b { 0%, 60%, 100% { transform: none; opacity: .5; } 30% { transform: translateY(-4px); opacity: 1; } }

/* input */
.ask-foot { flex: none; padding: 10px 12px 12px; border-top: 1px solid var(--ask-line); background: var(--ask-bg); padding-bottom: max(12px, env(safe-area-inset-bottom)); }
.ask-form { display: flex; gap: 8px; align-items: flex-end; }
.ask-input { flex: 1; min-width: 0; resize: none; max-height: 140px; min-height: 44px; font: 15px/1.4 var(--ask-font); color: var(--ask-ink);
  background: var(--ask-card); border: 1px solid var(--ask-line2); border-radius: 12px; padding: 11px 12px; outline: none; }
.ask-input:focus, .ask-pass:focus { border-color: var(--ask-green); box-shadow: 0 0 0 3px rgba(31,94,75,.15); }
.ask-input:disabled { background: var(--ask-bg2); }
.ask-send { flex: none; height: 44px; padding: 0 16px; border: 0; border-radius: 12px; background: var(--ask-green); color: #fff; font: 600 14.5px/1 var(--ask-font); cursor: pointer; }
.ask-send:disabled { opacity: .5; cursor: default; }
.ask-send:focus-visible, .ask-chip:focus-visible, .ask-x:focus-visible, .ask-link:focus-visible { outline: 3px solid #8CC1AE; outline-offset: 2px; }
.ask-meta { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 2px 8px; margin-top: 6px; font-size: 12px; color: var(--ask-muted); }
.ask-count.ask-near { color: var(--ask-red); }
.ask-link { font: inherit; color: var(--ask-green); background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }

/* passcode */
.ask-gate { padding: 4px 2px; }
.ask-gate h3 { margin: 0 0 4px; font: 600 16px/1.3 var(--ask-font); }
.ask-gate p { margin: 0 0 12px; font-size: 14px; color: var(--ask-ink2); }
.ask-pass { width: 100%; height: 44px; font: 15px var(--ask-font); color: var(--ask-ink); background: var(--ask-card); border: 1px solid var(--ask-line2); border-radius: 12px; padding: 0 12px; outline: none; }
.ask-gate .ask-send { margin-top: 10px; width: 100%; }
.ask-gate-err { margin-top: 10px; font-size: 13.5px; color: var(--ask-red); }
.ask-gate-err:empty { display: none; }

.ask-sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* mobile: full-screen sheet */
@media (max-width: 699px) {
  .ask-panel { top: 0; right: 0; bottom: 0; left: 0; width: 100%; max-width: none; border-radius: 0; border: 0;
    transform: translateY(100%); }
  .ask-head { padding-top: max(14px, env(safe-area-inset-top)); }
  .ask-fab { right: 14px; bottom: 14px; }
  .ask-fab.ask-left { left: 12px; }
  html.ask-lock, html.ask-lock body { overflow: hidden; }
}
@media (prefers-reduced-motion: reduce) { .ask-panel, .ask-panel.ask-open { transition: none; } .ask-typing i { animation: none; } }
@media print { .ask-fab, .ask-panel { display: none !important; } }
