/* SmartHopping AI agent widget: floating button, chat popup, live activity
   and the AI pointer. Self-contained (no Tailwind) so the same widget runs
   in the app and in the Control Center. Everything is prefixed .aa- */

.aa-root {
  --aa-bg: #ffffff;
  --aa-bg-soft: #fcfaf6;
  --aa-bg-card: #ffffff;
  --aa-border: rgba(217, 119, 6, 0.22);
  --aa-border-subtle: rgba(0, 0, 0, 0.06);
  --aa-text: #1c1917;
  --aa-muted: #78716c;
  --aa-accent: #d97706;
  --aa-gold: #f59e0b;
  --aa-gold-light: #fef3c7;
  --aa-gold-border: #fde68a;
  --aa-gold-deep: #b45309;
  --aa-ok: #059669;
  --aa-err: #dc2626;
  --aa-user-bg: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  --aa-grad: linear-gradient(135deg, #fbbf24 0%, #f59e0b 50%, #d97706 100%);
  --aa-shadow: 0 20px 48px -6px rgba(0, 0, 0, 0.35), 0 8px 24px -2px rgba(0, 0, 0, 0.16), 0 0 0 1px rgba(217, 119, 6, 0.22);
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--aa-text);
  -webkit-font-smoothing: antialiased;
}

html.dark .aa-root, html[data-theme="dark"] .aa-root, .aa-root.aa-dark {
  --aa-bg: #181614;
  --aa-bg-soft: #23201b;
  --aa-bg-card: #201d19;
  --aa-border: rgba(245, 158, 11, 0.26);
  --aa-border-subtle: rgba(255, 255, 255, 0.08);
  --aa-text: #fef3c7;
  --aa-muted: #a8a29e;
  --aa-user-bg: linear-gradient(135deg, #b45309 0%, #92400e 100%);
  --aa-shadow: 0 22px 52px -8px rgba(0, 0, 0, 0.8), 0 8px 24px -3px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(245, 158, 11, 0.28);
}

/* The chat body keeps its light backdrop and white bubbles/cards in dark mode,
   so text inside it stays dark (the header and composer follow the theme). */
html.dark .aa-root .aa-body, html[data-theme="dark"] .aa-root .aa-body, .aa-root.aa-dark .aa-body {
  --aa-text: #1c1917;
  --aa-muted: #78716c;
}

.aa-root *, .aa-root *::before, .aa-root *::after { box-sizing: border-box; }
.aa-root button { font-family: inherit; }

/* ── Floating action button & wrapper (transparent mascot, small close tab) ─ */
.aa-root { --aa-fab-size: 80px; }
.aa-fab-wrap {
  position: absolute; right: 10px; bottom: 84px; z-index: 1500;
  display: flex; align-items: center; justify-content: center;
  transition: transform .28s cubic-bezier(.16, 1, .3, 1), bottom .25s ease, opacity .2s ease;
}
.aa-fab-wrap.aa-hidden { opacity: 0; pointer-events: none; transform: scale(.6); }
.aa-fab-wrap.aa-collapsed {
  transform: translateX(calc(var(--aa-fab-size) * .55));
  opacity: 0.9;
}
.aa-fixed .aa-fab-wrap { position: fixed; right: 22px; bottom: 22px; }

/* Close tab: small, tucked onto the mascot's top-right shoulder */
.aa-fab-collapse {
  position: absolute; top: -4px; right: -6px; z-index: 12;
  width: 15px; height: 15px; border-radius: 50%; border: 1.25px solid #f59e0b;
  background: #ffffff; color: #b45309; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.22);
  padding: 0; line-height: 1;
  transition: transform .18s ease, background .15s ease, opacity .2s ease;
  -webkit-tap-highlight-color: transparent;
}
/* Invisible 28px hit area so the tiny tab is still easy to tap */
.aa-fab-collapse::before { content: ""; position: absolute; inset: -7px; border-radius: 50%; }
.aa-fab-collapse:hover { transform: scale(1.15); background: #fef3c7; }
.aa-fab-collapse:active { transform: scale(.9); }
.aa-fab-collapse svg { width: 7px; height: 7px; }
.aa-fab-wrap.aa-collapsed .aa-fab-collapse { display: none; }

.aa-fab {
  position: relative;
  width: var(--aa-fab-size); height: var(--aa-fab-size); border-radius: 0;
  border: none; padding: 0; outline: none;
  background: transparent; color: #b45309; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: none;
  transition: transform .18s ease, filter .2s ease;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
  overflow: visible;
}
.aa-fab:hover { transform: translateY(-1px) scale(1.05); }
.aa-fab:active { transform: scale(.93); }
.aa-fab.aa-collapsed { cursor: pointer; }
.aa-fab svg { width: 38px; height: 38px; filter: drop-shadow(0 2px 6px rgba(217, 119, 6, 0.45)); }
.aa-fab-img-box {
  position: relative; width: 100%; height: 100%; border-radius: 0; overflow: visible;
  background: transparent;
}
/* The mascot artwork is ~59% of its PNG (transparent margin all round, the
   disc a little right of centre): scale and shift it so the disc itself
   fills the button, and the close tab can sit right on its edge. */
.aa-fab-img, .aa-avatar-img {
  position: absolute; max-width: none;
  width: 163.5%; height: auto; left: -37.5%; top: -28.6%;
  transform-origin: 53.5% 50%;
}
.aa-fab-img {
  object-fit: contain; pointer-events: none;
  border-radius: 0;
  filter: drop-shadow(0 5px 12px rgba(0, 0, 0, 0.22)) drop-shadow(0 2px 6px rgba(217, 119, 6, 0.38));
  transition: transform .18s ease;
}
.aa-fab:hover .aa-fab-img { filter: drop-shadow(0 7px 16px rgba(217, 119, 6, 0.55)); }
.aa-fab::after { display: none; }
.aa-fab.aa-busy .aa-fab-img { animation: aa-fab-wobble 1.6s ease-in-out infinite; }
@keyframes aa-fab-wobble {
  0%, 100% { transform: rotate(0deg) scale(1); }
  25% { transform: rotate(-4deg) scale(1.04); }
  75% { transform: rotate(4deg) scale(1.04); }
}
.aa-fab.aa-hidden { opacity: 0; pointer-events: none; transform: scale(.6); }
.aa-fab-badge {
  position: absolute; top: 4px; left: 4px; min-width: 12px; height: 12px; padding: 0;
  border-radius: 50%; background: #d97706; border: 2px solid #fff;
  display: none; box-shadow: 0 1px 4px rgba(0,0,0,.25);
}
.aa-fab-badge.aa-on { display: block; animation: aa-badge-pulse 1.6s ease-in-out infinite; }
@keyframes aa-badge-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.18); } }

/* ── Chat panel (White & Gold, Deep Shadow, Festive Backdrop) ────────── */
.aa-panel {
  position: absolute; right: 12px;
  bottom: var(--aa-bottom, 148px);
  z-index: 1550;
  width: min(324px, calc(100% - 20px));
  height: min(305px, 39vh);
  min-height: 180px;
  max-height: min(325px, calc(100vh - 100px - var(--aa-kb-offset, 0px)));
  background: var(--aa-bg);
  border: 1px solid var(--aa-border);
  border-radius: 16px;
  box-shadow: var(--aa-shadow);
  display: flex; flex-direction: column; overflow: hidden;
  transform-origin: bottom right; animation: aa-in .18s ease-out;
  transition: bottom .2s ease, max-height .2s ease, height .2s ease;
}
.aa-fixed .aa-panel {
  position: fixed; right: 20px;
  bottom: 76px;
  width: 334px; height: min(340px, 42vh);
}
.aa-panel[hidden] { display: none; }
@keyframes aa-in { from { opacity: 0; transform: translateY(8px) scale(.97); } to { opacity: 1; transform: none; } }

/* Dynamic virtual keyboard avoidance: stays comfortably 8px above the keyboard */
.aa-root.aa-kb-open .aa-panel {
  top: auto !important;
  bottom: calc(var(--aa-kb-offset, 0px) + 8px) !important;
  height: min(205px, 28vh) !important;
  min-height: 130px !important;
  max-height: min(240px, calc(100vh - var(--aa-kb-offset, 0px) - 60px)) !important;
}
.aa-fixed.aa-kb-open .aa-panel {
  top: auto !important;
  bottom: calc(var(--aa-kb-offset, 0px) + 8px) !important;
  height: min(220px, 30vh) !important;
  min-height: 140px !important;
  max-height: min(260px, calc(100vh - var(--aa-kb-offset, 0px) - 60px)) !important;
}

/* Bottom nav is strictly suppressed while the keyboard or AI assistant chat input is active */
body.aa-kb-active #app-bottom-nav,
.aa-root.aa-kb-open ~ #app-bottom-nav,
.aa-root.aa-input-focused ~ #app-bottom-nav,
#phone-app:has(.aa-root.aa-kb-open) #app-bottom-nav,
#phone-app:has(.aa-root.aa-input-focused) #app-bottom-nav {
  display: none !important;
}

/* Header: clean, minimal, aesthetic */
.aa-head {
  display: flex; align-items: center; gap: 6px; padding: 4px 8px;
  border-bottom: 1px solid var(--aa-border); background: var(--aa-bg); flex-shrink: 0;
  min-height: 36px;
}
.aa-avatar {
  width: 24px; height: 24px; border-radius: 0;
  background: transparent; border: none; color: #fff;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0; position: relative;
  overflow: visible;
}
.aa-avatar svg { width: 14px; height: 14px; color: var(--aa-accent); }
.aa-avatar-img { object-fit: contain; }
.aa-working .aa-avatar-img {
  animation: aa-avatar-pulse 1.2s ease-in-out infinite;
}
@keyframes aa-avatar-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.12); }
}
.aa-title { flex: 1; min-width: 0; line-height: 1.1; }
.aa-title-row { display: flex; align-items: center; gap: 4px; }
.aa-title strong { display: inline-block; font-size: 11px; font-weight: 800; letter-spacing: -.01em; color: var(--aa-text); }
.aa-status { display: block; font-size: 8.5px; color: var(--aa-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.aa-status[hidden] { display: none !important; }

.aa-hbtn {
  width: 22px; height: 22px; border-radius: 5px; border: 0; background: transparent;
  color: var(--aa-muted); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0;
  transition: all .15s ease;
}
.aa-hbtn:hover { background: var(--aa-bg-soft); color: var(--aa-accent); }
.aa-hbtn svg { width: 12px; height: 12px; }
.aa-hbtn[hidden] { display: none !important; }
.aa-hbtn.aa-stop { color: var(--aa-err); }

/* Body with Kolkata Durga Puja backdrop illustration */
.aa-body {
  flex: 1; overflow-y: auto; padding: 6px 8px; display: flex; flex-direction: column; gap: 5px;
  background: #fffbf5 url('../assets/images/chatwindow_backdrop.png') center/cover no-repeat;
  scroll-behavior: smooth; overscroll-behavior: contain;
}
.aa-msg {
  max-width: 88%; font-size: 10.5px; line-height: 1.32; padding: 4.5px 8px;
  border-radius: 10px; word-wrap: break-word; white-space: normal;
}
.aa-msg.aa-user {
  align-self: flex-end; background: var(--aa-user-bg); color: #ffffff;
  border-bottom-right-radius: 2px; box-shadow: 0 2px 6px -1px rgba(217, 119, 6, 0.32);
}
.aa-msg.aa-bot {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(217, 119, 6, 0.22);
  border-bottom-left-radius: 2px; color: var(--aa-text);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}
.aa-msg.aa-err {
  align-self: flex-start; background: rgba(255, 240, 240, 0.94); color: var(--aa-err);
  border: 1px solid rgba(220,38,38,.25); font-size: 10px;
}
.aa-msg ul { margin: 2px 0 0; padding-left: 12px; }
.aa-msg li { margin: 1px 0; }
.aa-msg .aa-retry { margin-top: 3px; }
.aa-notice { align-self: center; font-size: 8.5px; color: var(--aa-muted); }

/* Live chain-of-action card */
.aa-activity {
  align-self: stretch;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(217, 119, 6, 0.22);
  border-radius: 9px; padding: 4px 6px; font-size: 10px; box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.aa-activity-h {
  display: flex; align-items: center; gap: 4px; font-size: 8px; text-transform: uppercase;
  letter-spacing: .06em; font-weight: 800; color: var(--aa-gold-deep); margin-bottom: 2px;
}
.aa-step { display: flex; align-items: flex-start; gap: 4px; padding: 1.5px 0; color: var(--aa-text); font-size: 9.5px; }
.aa-step .aa-ic {
  width: 11px; height: 11px; margin-top: 1px; flex-shrink: 0; display: inline-flex;
  align-items: center; justify-content: center;
}
.aa-step .aa-ic svg { width: 11px; height: 11px; }
.aa-step.aa-running .aa-ic::before {
  content: ""; width: 8px; height: 8px; border-radius: 50%;
  border: 1.6px solid var(--aa-gold-border); border-top-color: var(--aa-accent); animation: aa-spin .8s linear infinite;
}
.aa-step.aa-done .aa-ic { color: var(--aa-ok); }
.aa-step.aa-error .aa-ic { color: var(--aa-err); }
.aa-step.aa-skipped { opacity: .55; }
.aa-step.aa-think { color: var(--aa-muted); }
.aa-step small { display: block; color: var(--aa-muted); font-size: 8.5px; }
.aa-thought { color: var(--aa-muted); font-style: italic; padding: 1px 0 1px 12px; position: relative; font-size: 9.5px; }
.aa-thought::before {
  content: ""; position: absolute; left: 3px; top: 6px; width: 3px; height: 3px; border-radius: 50%;
  background: var(--aa-gold); opacity: .75;
}
@keyframes aa-spin { to { transform: rotate(360deg); } }

/* Tappable options and approval cards */
.aa-card {
  align-self: stretch;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(217, 119, 6, 0.25);
  border-radius: 10px; padding: 5px 6px; font-size: 10px; box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}
.aa-card.aa-danger { border-color: rgba(220,38,38,.35); box-shadow: inset 2.5px 0 0 var(--aa-err); }
.aa-card.aa-approve { border-color: var(--aa-gold-border); box-shadow: inset 2.5px 0 0 var(--aa-gold); }
.aa-card-q { font-weight: 700; margin-bottom: 4px; line-height: 1.25; font-size: 10.5px; color: var(--aa-text); }
.aa-opts { display: flex; flex-wrap: wrap; gap: 3.5px; }
.aa-opt {
  border: 1px solid var(--aa-border); background: #ffffff; color: var(--aa-text);
  border-radius: 999px; padding: 2.5px 7px; font-size: 9.5px; font-weight: 700; cursor: pointer;
  transition: all .15s;
}
.aa-opt:hover:not(:disabled) { border-color: var(--aa-accent); color: var(--aa-accent); background: var(--aa-gold-light); }
.aa-opt.aa-picked { background: var(--aa-accent); border-color: var(--aa-accent); color: #fff; }
.aa-opt:disabled { cursor: default; opacity: .6; }
.aa-opt.aa-picked:disabled { opacity: 1; }
.aa-opt.aa-primary { background: var(--aa-grad); border: 0; color: #fff; }
.aa-opt.aa-danger-btn { background: var(--aa-err); border-color: var(--aa-err); color: #fff; }
.aa-kv {
  margin: 0 0 4px; padding: 4px 6px; background: var(--aa-bg-soft); border-radius: 6px;
  font-size: 9px; display: grid; grid-template-columns: max-content 1fr; gap: 2px 5px;
}
.aa-kv dt { color: var(--aa-muted); font-weight: 700; }
.aa-kv dd { margin: 0; word-break: break-word; }
.aa-result-note { margin-top: 3px; font-size: 9px; color: var(--aa-muted); }

/* Composer */
.aa-foot {
  border-top: 1px solid var(--aa-border); padding: 4px 6px; background: var(--aa-bg); flex-shrink: 0;
}
.aa-suggest { display: flex; gap: 3.5px; overflow-x: auto; padding-bottom: 3.5px; scrollbar-width: none; }
.aa-suggest::-webkit-scrollbar { display: none; }
.aa-suggest[hidden] { display: none; }
.aa-suggest .aa-opt {
  white-space: nowrap; font-weight: 600; font-size: 9.5px; padding: 2.5px 6px;
  background: var(--aa-bg-soft); border-color: var(--aa-border);
}
.aa-compose { display: flex; align-items: flex-end; gap: 4px; }
.aa-input {
  flex: 1; resize: none; border: 1px solid var(--aa-border); background: var(--aa-bg-soft);
  color: var(--aa-text); border-radius: 9px; padding: 4px 7px; font: inherit; font-size: 10.5px;
  line-height: 1.3; max-height: 64px; min-height: 28px; outline: none; transition: border-color .15s, box-shadow .15s;
}
.aa-input:focus { border-color: var(--aa-gold); box-shadow: 0 0 0 2px rgba(245, 158, 11, .2); }
.aa-send {
  width: 28px; height: 28px; border-radius: 7px; border: 0; background: var(--aa-grad);
  color: #fff; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0;
  box-shadow: 0 2px 5px rgba(217, 119, 6, 0.35); transition: transform .12s, opacity .15s;
}
.aa-send:hover:not(:disabled) { transform: scale(1.05); }
.aa-send:active:not(:disabled) { transform: scale(.93); }
.aa-send:disabled { opacity: .45; cursor: default; }
.aa-send svg { width: 13px; height: 13px; }
.aa-fine { display: none; }

/* ── Mini live bar while the agent operates the UI ─────────────────────
   A narrow pill at the top: avatar, one line of status, the controls, and
   a thin animated live strip along its bottom edge. The whole screen stays
   visible and tappable underneath. */
.aa-live-strip { display: none; }
.aa-panel.aa-mini,
.aa-root.aa-kb-open .aa-panel.aa-mini {
  top: calc(env(safe-area-inset-top, 0px) + 10px) !important;
  bottom: auto !important;
  left: auto !important;
  right: 10px !important;
  width: min(236px, calc(100% - 96px)) !important;
  height: 32px !important;
  min-height: 32px !important;
  max-height: 32px !important;
  border-radius: 16px !important;
  padding: 0 !important;
  background: rgba(255, 255, 255, 0.97) !important;
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(217, 119, 6, 0.3) !important;
  overflow: hidden !important;
  transition: none !important; /* snap to the bar; aa-drop-in is the motion */
  animation: aa-drop-in .26s cubic-bezier(.16, 1, .3, 1) !important;
}
html.dark .aa-panel.aa-mini, .aa-root.aa-dark .aa-panel.aa-mini { background: rgba(32, 29, 25, 0.96) !important; }
.aa-fixed .aa-panel.aa-mini { top: 14px !important; right: 20px !important; width: 300px !important; }
@keyframes aa-drop-in { from { opacity: 0; transform: translateY(-10px) scale(.96); } to { opacity: 1; transform: none; } }
.aa-panel.aa-mini .aa-body,
.aa-panel.aa-mini .aa-foot,
.aa-panel.aa-mini [data-a="new"],
.aa-panel.aa-mini [data-a="expand"],
.aa-panel.aa-mini .aa-title strong { display: none !important; }
.aa-panel.aa-mini .aa-head {
  height: 32px !important; min-height: 32px !important;
  padding: 0 4px 0 6px !important; gap: 2px !important;
  border-bottom: 0 !important; background: transparent !important; position: relative;
}
.aa-panel.aa-mini .aa-avatar { width: 22px; height: 22px; }
.aa-panel.aa-mini .aa-status {
  display: block !important; margin: 0 !important;
  color: var(--aa-text) !important; font-weight: 700 !important; font-size: 10px !important;
  white-space: nowrap !important; overflow: hidden !important; text-overflow: ellipsis !important;
}
.aa-panel.aa-mini .aa-hbtn { width: 24px; height: 24px; border-radius: 50%; }
.aa-panel.aa-mini .aa-live-strip {
  display: block; position: absolute; left: 12px; right: 12px; bottom: 0; height: 2px; border-radius: 2px;
  background: linear-gradient(90deg, rgba(245,158,11,0) 0%, #f59e0b 35%, #fde047 50%, #d97706 65%, rgba(217,119,6,0) 100%);
  background-size: 200% 100%;
  animation: aa-strip 1.3s linear infinite;
}
.aa-panel.aa-mini.aa-paused .aa-live-strip { animation-play-state: paused; opacity: .45; }
@keyframes aa-strip { from { background-position: 200% 0; } to { background-position: 0 0; } }

/* Coming back down from the bar (a question, an approval, the answer) */
.aa-panel.aa-rise { animation: aa-rise .28s cubic-bezier(.16, 1, .3, 1); }
@keyframes aa-rise { from { opacity: 0; transform: translateY(14px) scale(.97); } to { opacity: 1; transform: none; } }

/* Top-left drag handle for resizable chat window */
.aa-resize-handle {
  position: absolute; top: 0; left: 0; width: 18px; height: 18px;
  cursor: nwse-resize; z-index: 20; display: flex; align-items: flex-start; justify-content: flex-start;
  padding: 3px;
}
.aa-resize-handle::after {
  content: ""; width: 7px; height: 7px;
  border-top: 2px solid var(--aa-accent);
  border-left: 2px solid var(--aa-accent);
  border-top-left-radius: 3px;
  opacity: 0.6;
  transition: opacity .15s ease, transform .15s ease;
}
.aa-resize-handle:hover::after { opacity: 1; transform: scale(1.15); }
.aa-panel.aa-mini .aa-resize-handle { display: none !important; }

/* ── Desktop co-pilot (Control Center): roomier window, readable type, and
   an expand button for a large working window. */
.aa-mode-admin { --aa-fab-size: 100px; }
.aa-mode-admin .aa-panel {
  width: 440px;
  height: min(620px, calc(100vh - 170px));
  min-width: 320px;
  min-height: 240px;
  max-width: calc(100vw - 36px);
  max-height: calc(100vh - 120px);
  bottom: 142px;
}
.aa-mode-admin .aa-panel.aa-large {
  width: min(940px, calc(100vw - 36px)) !important;
  height: min(740px, calc(100vh - 140px)) !important;
  max-height: calc(100vh - 110px) !important;
}
.aa-mode-admin .aa-head { min-height: 46px; padding: 6px 10px; gap: 8px; }
.aa-mode-admin .aa-avatar { width: 32px; height: 32px; }
.aa-mode-admin .aa-title strong { font-size: 14px; }
.aa-mode-admin .aa-status { font-size: 11px; }
.aa-mode-admin .aa-hbtn { width: 28px; height: 28px; border-radius: 7px; }
.aa-mode-admin .aa-hbtn svg { width: 15px; height: 15px; }
.aa-mode-admin .aa-body { padding: 10px 12px; gap: 8px; }
.aa-mode-admin .aa-msg { font-size: 13.5px; line-height: 1.5; padding: 7px 11px; border-radius: 12px; }
.aa-mode-admin .aa-large .aa-msg { max-width: 80%; }
.aa-mode-admin .aa-activity { font-size: 12.5px; padding: 7px 10px; }
.aa-mode-admin .aa-activity-h { font-size: 10px; }
.aa-mode-admin .aa-step { font-size: 12.5px; padding: 2px 0; }
.aa-mode-admin .aa-step small { font-size: 11px; }
.aa-mode-admin .aa-step .aa-ic, .aa-mode-admin .aa-step .aa-ic svg { width: 14px; height: 14px; }
.aa-mode-admin .aa-thought { font-size: 12px; }
.aa-mode-admin .aa-card { font-size: 12.5px; padding: 9px 11px; }
.aa-mode-admin .aa-card-q { font-size: 13.5px; }
.aa-mode-admin .aa-opt { font-size: 12px; padding: 5px 11px; }
.aa-mode-admin .aa-kv { font-size: 12px; }
.aa-mode-admin .aa-notice { font-size: 11px; }
.aa-mode-admin .aa-foot { padding: 8px 10px; }
.aa-mode-admin .aa-suggest .aa-opt { font-size: 12px; padding: 4px 10px; }
.aa-mode-admin .aa-input { font-size: 13.5px; min-height: 38px; max-height: 140px; padding: 8px 11px; border-radius: 11px; }
.aa-mode-admin .aa-send { width: 38px; height: 38px; border-radius: 10px; }
.aa-mode-admin .aa-send svg { width: 17px; height: 17px; }
.aa-mode-admin .aa-msg a { color: var(--aa-gold-deep); text-decoration: underline; word-break: break-all; }
.aa-msg img.aa-inline-img { display: block; max-width: 100%; max-height: 180px; border-radius: 8px; margin: 4px 0; object-fit: cover; }
.aa-img-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 6px; margin-top: 6px; }
.aa-img-grid figure { margin: 0; border-radius: 8px; overflow: hidden; border: 1px solid var(--aa-border); background: var(--aa-bg-soft); }
.aa-img-grid img { width: 100%; height: 84px; object-fit: cover; display: block; }
.aa-img-grid figcaption { font-size: 10.5px; padding: 3px 5px; color: var(--aa-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.aa-sources { margin-top: 6px; font-size: 11px; color: var(--aa-muted); }
.aa-sources a { color: var(--aa-gold-deep); }

/* ── AI pointer (Golden Festive Cursor & Rings) ───────────────────────── */
.aa-pointer {
  position: fixed; left: 0; top: 0; z-index: 2147483000; pointer-events: none;
  width: 28px; height: 28px; transform: translate(-100px, -100px);
  transition: transform .5s cubic-bezier(.22,.9,.32,1), opacity .25s ease; opacity: 0; will-change: transform;
}
.aa-pointer.aa-on { opacity: 1; }
.aa-pointer svg { width: 28px; height: 28px; filter: drop-shadow(0 0 8px rgba(245,158,11,.85)) drop-shadow(0 2px 4px rgba(0,0,0,.35)); }
/* The pointer is appended to <body>, outside .aa-root, so its chip must not
   rely on the widget's colour variables. */
.aa-pointer-tag {
  position: absolute; left: 20px; top: 21px; padding: 3px 8px; border-radius: 999px;
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%); color: #ffffff;
  border: 1px solid rgba(255, 255, 255, .85);
  font: 800 9.5px/1.25 "Plus Jakarta Sans", system-ui, -apple-system, sans-serif; letter-spacing: .01em;
  text-shadow: 0 1px 1px rgba(120, 53, 15, .45);
  white-space: nowrap; max-width: 190px; overflow: hidden; text-overflow: ellipsis;
  box-shadow: 0 2px 8px rgba(217, 119, 6, .45), 0 0 0 0 rgba(245, 158, 11, .55);
  animation: aa-tag-glow 1.6s ease-in-out infinite;
}
@keyframes aa-tag-glow {
  0%, 100% { box-shadow: 0 2px 8px rgba(217, 119, 6, .45), 0 0 0 0 rgba(245, 158, 11, .5); }
  50% { box-shadow: 0 2px 12px rgba(217, 119, 6, .6), 0 0 0 4px rgba(245, 158, 11, 0); filter: brightness(1.08); }
}
.aa-pointer.aa-pressing svg { transform: scale(.82); transition: transform .12s; }
.aa-ripple {
  position: fixed; z-index: 2147482999; pointer-events: none; width: 16px; height: 16px; margin: -8px 0 0 -8px;
  border-radius: 50%; border: 2.5px solid #f59e0b; animation: aa-ripple .6s ease-out forwards;
}
@keyframes aa-ripple { from { transform: scale(.4); opacity: 1; } to { transform: scale(3.4); opacity: 0; } }
.aa-ring {
  position: fixed; z-index: 2147482998; pointer-events: none; border-radius: 12px;
  border: 2px solid #f59e0b; background: rgba(245, 158, 11, 0.08);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.25), 0 0 18px rgba(245, 158, 11, 0.42);
  transition: all .3s ease; opacity: 0;
}
.aa-ring.aa-on { opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  .aa-pointer { transition-duration: .01s; }
  .aa-fab::after, .aa-ripple, .aa-pointer-tag, .aa-live-strip, .aa-panel.aa-mini, .aa-panel.aa-rise { animation: none !important; }
}

/* Formatted replies (renderText): headings, paragraphs, lists, code, tables */
.aa-msg p { margin: 0 0 5px; }
.aa-msg p:last-child { margin-bottom: 0; }
.aa-msg .aa-h { font-weight: 800; color: var(--aa-gold-deep, #b45309); margin: 6px 0 3px; line-height: 1.25; }
.aa-msg .aa-h:first-child { margin-top: 0; }
.aa-msg .aa-h1 { font-size: 1.14em; }
.aa-msg .aa-h2 { font-size: 1.08em; }
.aa-msg .aa-h3 { font-size: 1.02em; }
.aa-msg ul, .aa-msg ol { margin: 2px 0 5px; padding-left: 16px; }
.aa-msg ol { list-style: decimal; }
.aa-msg ul { list-style: disc; }
.aa-msg ul ul, .aa-msg ol ul { list-style: circle; margin: 1px 0 2px; }
.aa-msg li { margin: 1px 0; }
.aa-msg li::marker { color: var(--aa-accent, #d97706); }
.aa-msg code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .92em; background: rgba(217, 119, 6, .1); color: var(--aa-gold-deep, #b45309); padding: 0 4px; border-radius: 4px; }
.aa-msg em { font-style: italic; }
.aa-msg hr { border: 0; border-top: 1px solid var(--aa-border, rgba(217,119,6,.25)); margin: 6px 0; }
.aa-msg .aa-table { overflow-x: auto; margin: 4px 0; }
.aa-msg table { border-collapse: collapse; font-size: .95em; }
.aa-msg th, .aa-msg td { border: 1px solid var(--aa-border, rgba(217,119,6,.25)); padding: 2px 6px; text-align: left; vertical-align: top; }
.aa-msg th { background: rgba(217, 119, 6, .08); font-weight: 700; }
