/* Brand Assistant — floating chat. Drop-in stylesheet. */

#ba-shell {
  --ba-accent: #7c3aed;
  --ba-bg: #0e1320;
  --ba-bg-2: #161b2c;
  --ba-border: rgba(255, 255, 255, 0.08);
  --ba-text: #e6e8ee;
  --ba-text-2: #9aa3b3;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

#ba-shell .ba-hidden { display: none !important; }

/* The mascot is a wrapper so we can position the bubble + speech bubble +
   shadow as a unit, drag it, and animate the whole thing. */
#ba-shell .ba-mascot {
  position: fixed;
  bottom: 22px;
  right: 22px;
  width: 96px;
  height: 96px;
  z-index: 9998;
  user-select: none;
  perspective: 600px;
  /* No animation on the wrapper itself — it must stay still so the nested
     chat panel (positioned 100% above) doesn't tilt with it. All animation
     is on the inner .ba-bubble below. */
}

#ba-shell .ba-mascot.ba-mascot-dragging {
  cursor: grabbing;
}
#ba-shell .ba-mascot.ba-mascot-dragging .ba-mascot-inner {
  animation: none;
}

/* .ba-mascot-inner wraps the chibi (bubble + shadow + speech) and carries
   ALL the animation. The outer .ba-mascot wrapper holds the panel too,
   so it must stay still — otherwise the panel inherits the wrapper's
   rotation and tilts visibly above the chibi (because it's ~600px above
   the rotation pivot, even a 1° rotation reads as a big tilt up there). */
#ba-shell .ba-mascot-inner {
  position: relative;
  width: 100%;
  height: 100%;
  animation: ba-float 4.2s ease-in-out infinite;
}

#ba-shell .ba-mascot-thinking  .ba-mascot-inner { animation: ba-think 1.4s ease-in-out infinite; }
#ba-shell .ba-mascot-happy     .ba-mascot-inner { animation: ba-happy 0.7s cubic-bezier(0.34,1.56,0.64,1) 1; }
#ba-shell .ba-mascot-listening .ba-mascot-inner { animation: ba-listen 0.5s ease-in-out infinite; }
#ba-shell .ba-mascot-alert     .ba-mascot-inner { animation: ba-alert 0.85s cubic-bezier(0.34,1.56,0.64,1) 1; }

@keyframes ba-alert {
  0%   { transform: translateY(0) scale(1) rotate(0); }
  20%  { transform: translateY(-14px) scale(1.12) rotate(-8deg); }
  40%  { transform: translateY(-2px) scale(1.04) rotate(6deg); }
  60%  { transform: translateY(-10px) scale(1.08) rotate(-4deg); }
  100% { transform: translateY(0) scale(1) rotate(0); }
}

/* Pacing transforms applied while the mascot is thinking — combined with the
   frame-swap (think / thinkLeft / thinkRight) it reads as a character pacing
   while pondering. The .ba-mascot already has its own float animation, so
   these classes use a separate property — `--pace-x` is added via transform
   on the inner bubble so it composes cleanly. */
#ba-shell .ba-mascot.ba-pace-left  .ba-bubble { transform: translateX(-14px) rotateZ(-3deg); transition: transform 0.55s cubic-bezier(0.4,0,0.2,1); }
#ba-shell .ba-mascot.ba-pace-right .ba-bubble { transform: translateX(14px)  rotateZ(3deg);  transition: transform 0.55s cubic-bezier(0.4,0,0.2,1); }
#ba-shell .ba-mascot.ba-pace-center .ba-bubble { transform: translateX(0); transition: transform 0.55s cubic-bezier(0.4,0,0.2,1); }

/* Listening — chibi leans toward the center of the screen (away from his
   default bottom-right anchor) to convey "I'm leaning in to hear you". */
#ba-shell .ba-mascot-listening .ba-mascot-inner { animation: ba-listen-lean 0.6s ease-in-out 1 forwards; }

@keyframes ba-listen-lean {
  0%   { transform: translate(0, 0) rotate(0); }
  100% { transform: translate(-12px, -8px) rotate(-6deg); }
}

@keyframes ba-listen {
  0%, 100% { transform: translateY(0) rotate(-3deg); }
  50%      { transform: translateY(-2px) rotate(3deg); }
}

@keyframes ba-float {
  0%, 100% { transform: translateY(0) rotate(-1deg); }
  50%      { transform: translateY(-7px) rotate(1deg); }
}
@keyframes ba-think {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50%      { transform: translateY(-4px) rotate(2deg); }
}
@keyframes ba-happy {
  0%   { transform: translateY(0) scale(1); }
  40%  { transform: translateY(-12px) scale(1.08); }
  100% { transform: translateY(0) scale(1); }
}

/* Soft elliptical shadow on the ground that scales with the float to give
   a parallax/depth feel. */
#ba-shell .ba-mascot-shadow {
  position: absolute;
  left: 50%;
  bottom: -6px;
  width: 70%;
  height: 10px;
  background: radial-gradient(ellipse, rgba(0,0,0,0.45), rgba(0,0,0,0) 70%);
  transform: translateX(-50%);
  border-radius: 50%;
  filter: blur(2px);
  animation: ba-shadow 4.2s ease-in-out infinite;
  pointer-events: none;
}

@keyframes ba-shadow {
  0%, 100% { transform: translateX(-50%) scale(1); opacity: 0.6; }
  50%      { transform: translateX(-50%) scale(0.8); opacity: 0.4; }
}

#ba-shell .ba-bubble {
  position: relative;
  width: 96px;
  height: 96px;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
  border: none;
  outline: none;
  color: #fff;
  font-size: 36px;
  cursor: grab;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.18s ease;
  padding: 0;
  transform-style: preserve-3d;
}

/* Orange glow disc — separate layer behind the mascot. Soft radial gradient
   that pulses subtly so the bubble reads as a glowing presence. */
#ba-shell .ba-bubble::before {
  content: "";
  position: absolute;
  inset: -22px;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    color-mix(in srgb, var(--ba-accent) 70%, transparent) 0%,
    color-mix(in srgb, var(--ba-accent) 40%, transparent) 35%,
    color-mix(in srgb, var(--ba-accent) 15%, transparent) 60%,
    transparent 80%
  );
  filter: blur(8px);
  pointer-events: none;
  z-index: 0;
  animation: ba-glow-pulse 3.2s ease-in-out infinite;
}

@keyframes ba-glow-pulse {
  0%, 100% { transform: scale(1);    opacity: 0.85; }
  50%      { transform: scale(1.1);  opacity: 1; }
}

#ba-shell .ba-bubble:hover::before {
  animation-duration: 1.6s;
}

#ba-shell .ba-bubble:hover {
  transform: rotateY(8deg) scale(1.08);
}

#ba-shell .ba-bubble-mascot {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

#ba-shell .ba-mascot-dragging .ba-bubble { cursor: grabbing; transform: scale(1.05); }

/* Speech bubble — Clippy-style nudge that pops out beside the mascot when
   there's something to say. Positioned above-left so it doesn't go off-screen
   in the default bottom-right anchor. Dark themed to match the panel. */
#ba-shell .ba-speech {
  position: absolute;
  bottom: calc(100% + 12px);
  right: 0;
  min-width: 220px;
  max-width: 320px;
  background: var(--ba-bg);
  color: var(--ba-text);
  padding: 10px 30px 10px 14px;
  border-radius: 12px;
  border: 2px solid color-mix(in srgb, var(--ba-accent) 55%, var(--ba-border));
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  font-size: 13px;
  line-height: 1.45;
  font-family: inherit;
  animation: ba-speech-pop 0.32s cubic-bezier(0.4, 0, 0.2, 1.6);
}

#ba-shell .ba-speech::after {
  content: "";
  position: absolute;
  bottom: -10px;
  right: 22px;
  width: 16px;
  height: 16px;
  background: var(--ba-bg);
  border-right: 2px solid color-mix(in srgb, var(--ba-accent) 55%, var(--ba-border));
  border-bottom: 2px solid color-mix(in srgb, var(--ba-accent) 55%, var(--ba-border));
  transform: rotate(45deg);
}

@keyframes ba-speech-pop {
  0%   { transform: translateY(8px) scale(0.85); opacity: 0; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}

#ba-shell .ba-speech-close {
  position: absolute;
  top: 4px;
  right: 6px;
  background: transparent;
  border: none;
  color: #6b7280;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  width: 22px;
  height: 22px;
  border-radius: 4px;
}

#ba-shell .ba-speech-close { color: var(--ba-text-2); }
#ba-shell .ba-speech-close:hover { background: rgba(255,255,255,0.08); color: var(--ba-text); }

#ba-shell .ba-speech-text { white-space: pre-wrap; }

#ba-shell .ba-bubble-emoji {
  display: block;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,0.35));
}

/* (panel position now defined in the main .ba-panel block) */

#ba-shell .ba-bubble-dot {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #22c55e;
  border: 2px solid var(--ba-bg);
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 0.2s, transform 0.2s;
}

#ba-shell .ba-bubble-nudge .ba-bubble-dot {
  opacity: 1;
  transform: scale(1);
  animation: ba-pulse 1.4s ease-in-out infinite;
}

@keyframes ba-pulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(34,197,94,0.6); }
  50%      { box-shadow: 0 0 0 6px rgba(34,197,94,0); }
}

/* The panel is the mascot's speech bubble — nested inside .ba-mascot so it
   moves with him when dragged. Anchored to his head with a tail pointing
   down. Less Slack, more Clippy. */
#ba-shell .ba-panel {
  position: absolute;
  bottom: calc(100% + 24px);
  right: 0;
  width: 420px;
  max-width: calc(100vw - 44px);
  height: 600px;
  max-height: calc(100vh - 170px);
  background: linear-gradient(180deg, var(--ba-bg-2) 0%, var(--ba-bg) 100%);
  border: 2px solid color-mix(in srgb, var(--ba-accent) 55%, var(--ba-border));
  /* Asymmetric radii give an organic, comic-bubble feel — not a rectangular chat box */
  border-radius: 32px 32px 16px 32px / 28px 28px 16px 28px;
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.55),
    0 0 0 6px color-mix(in srgb, var(--ba-accent) 12%, transparent);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  color: var(--ba-text);
  overflow: hidden;
  animation: ba-panel-pop 0.32s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes ba-panel-pop {
  0%   { transform: translateY(8px) scale(0.92); opacity: 0; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}

/* Tail + thinking-bubble trailers removed — they conflicted visually with
   the orange Send button at the bottom-right of the panel. Vertical gap to
   the mascot below conveys the speech-bubble relationship cleanly. */
#ba-shell .ba-panel-tail { display: none; }

#ba-shell .ba-panel-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--ba-border);
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--ba-accent) 30%, var(--ba-bg-2)) 0%,
    var(--ba-bg-2) 100%);
}

/* Mini mascot avatar in the panel header — keeps the character present even
   when you're scrolled deep into the conversation. */
#ba-shell .ba-panel-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--ba-accent);
  flex-shrink: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  border: 2px solid rgba(255,255,255,0.15);
}

#ba-shell .ba-panel-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#ba-shell .ba-panel-avatar span {
  font-size: 20px;
}

#ba-shell .ba-panel-titles {
  flex: 1;
  min-width: 0;
}

#ba-shell .ba-panel-titles strong {
  font-size: 15px;
  font-weight: 700;
  display: block;
  letter-spacing: 0.2px;
}

#ba-shell .ba-panel-sub {
  display: block;
  font-size: 10px;
  color: var(--ba-text-2);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 2px;
}

#ba-shell .ba-icon-btn {
  background: transparent;
  border: none;
  color: var(--ba-text-2);
  font-size: 22px;
  cursor: pointer;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  line-height: 1;
}

#ba-shell .ba-header-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--ba-border);
  color: var(--ba-text);
  font-size: 11px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 999px;
  cursor: pointer;
  letter-spacing: 0.4px;
}

#ba-shell .ba-header-btn:hover {
  background: color-mix(in srgb, var(--ba-accent) 22%, transparent);
  border-color: color-mix(in srgb, var(--ba-accent) 50%, var(--ba-border));
}

#ba-shell .ba-learning-note {
  margin-top: 6px;
  padding: 6px 10px;
  background: rgba(253, 224, 71, 0.10);
  border-left: 2px solid #fde047;
  border-radius: 4px;
  font-size: 12px;
  color: #fde047;
}

#ba-shell .ba-learning-note em {
  color: var(--ba-text);
  font-style: normal;
}

#ba-shell .ba-icon-btn:hover {
  color: var(--ba-text);
  background: rgba(255, 255, 255, 0.05);
}

#ba-shell .ba-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
}

#ba-shell .ba-empty {
  color: var(--ba-text-2);
  font-size: 12px;
  font-style: italic;
  text-align: center;
  padding: 30px 14px;
}

#ba-shell .ba-msg {
  max-width: 92%;
  border-radius: 10px;
  padding: 8px 12px;
  line-height: 1.5;
  word-wrap: break-word;
}

#ba-shell .ba-msg-user {
  align-self: flex-end;
  background: color-mix(in srgb, var(--ba-accent) 22%, transparent);
  border: 1px solid color-mix(in srgb, var(--ba-accent) 38%, transparent);
}

#ba-shell .ba-msg-bot {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--ba-border);
}

#ba-shell .ba-msg-failed {
  border-color: rgba(248, 113, 113, 0.5) !important;
}

#ba-shell .ba-msg-body {
  white-space: pre-wrap;
}

/* Inline 3-dot typing indicator (when assistant is streaming text) */
#ba-shell .ba-typing-inline {
  display: inline-flex;
  gap: 3px;
  margin-left: 6px;
  vertical-align: middle;
}

#ba-shell .ba-typing-inline span {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--ba-text-2);
  animation: ba-bounce 1.2s ease-in-out infinite;
}

#ba-shell .ba-typing-inline span:nth-child(2) { animation-delay: 0.15s; }
#ba-shell .ba-typing-inline span:nth-child(3) { animation-delay: 0.3s; }

/* Larger 3-dot thinking indicator (before any text has arrived) */
#ba-shell .ba-thinking {
  display: inline-flex;
  gap: 5px;
  padding: 2px 4px;
  align-items: center;
}

#ba-shell .ba-thinking span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--ba-accent) 65%, transparent);
  animation: ba-bounce 1.2s ease-in-out infinite;
}

#ba-shell .ba-thinking span:nth-child(2) { animation-delay: 0.15s; }
#ba-shell .ba-thinking span:nth-child(3) { animation-delay: 0.3s; }

@keyframes ba-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.45; }
  30%           { transform: translateY(-4px); opacity: 1; }
}

#ba-shell .ba-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  color: #34d399;
  background: rgba(52, 211, 153, 0.12);
  border: 1px solid rgba(52, 211, 153, 0.4);
  border-radius: 999px;
}

#ba-shell .ba-err {
  margin-top: 4px;
  color: #fca5a5;
  font-size: 12px;
}

#ba-shell .ba-proposal {
  margin-top: 8px;
  padding: 8px 10px;
  background: rgba(234, 179, 8, 0.10);
  border: 1px solid rgba(234, 179, 8, 0.45);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#ba-shell .ba-proposal-text {
  font-size: 11px;
  color: #fde047;
  font-weight: 600;
  letter-spacing: 0.4px;
}

#ba-shell .ba-proposal-actions {
  display: flex;
  gap: 6px;
}

#ba-shell .ba-btn {
  flex: 1;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid var(--ba-border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--ba-text);
}

#ba-shell .ba-btn-accept {
  background: rgba(34, 197, 94, 0.25);
  border-color: rgba(34, 197, 94, 0.55);
  color: #86efac;
}

#ba-shell .ba-btn-reject {
  background: rgba(234, 179, 8, 0.20);
  border-color: rgba(234, 179, 8, 0.55);
  color: #fde047;
}

#ba-shell .ba-screenshot-preview {
  position: relative;
  margin: 0 12px 8px;
  padding: 6px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--ba-border);
  border-radius: 8px;
}

#ba-shell .ba-screenshot-preview img {
  display: block;
  width: 100%;
  max-height: 140px;
  object-fit: contain;
  border-radius: 4px;
  background: #000;
}

#ba-shell .ba-screenshot-preview .ba-icon-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
}

#ba-shell .ba-attach-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--ba-border);
  color: var(--ba-text);
  border-radius: 8px;
  width: 38px;
  min-width: 38px;
  height: 38px;
  align-self: flex-end;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
}

#ba-shell .ba-attach-btn:hover {
  border-color: var(--ba-accent);
}

#ba-shell .ba-attach-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

#ba-shell .ba-input-row {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--ba-border);
  background: var(--ba-bg-2);
}

#ba-shell .ba-input {
  flex: 1;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--ba-border);
  border-radius: 8px;
  color: var(--ba-text);
  font-family: inherit;
  font-size: 13px;
  line-height: 1.5;
  padding: 8px 10px;
  resize: none;
  min-height: 38px;
  max-height: 120px;
}

#ba-shell .ba-input:focus {
  outline: none;
  border-color: var(--ba-accent);
}

#ba-shell .ba-send {
  align-self: flex-end;
  background: var(--ba-accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

#ba-shell .ba-send:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* ---- Screenshot mode picker ---- */
.ba-mode-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.ba-mode-card {
  background: #161b2c;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  padding: 16px;
  min-width: 280px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.55);
}
.ba-mode-btn {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.12);
  color: #e6e8ee;
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  text-align: left;
}
.ba-mode-btn:hover { background: rgba(255,255,255,0.10); }
.ba-mode-cancel {
  background: transparent;
  border: none;
  color: #9aa3b3;
  padding: 8px;
  cursor: pointer;
  font-size: 13px;
  align-self: center;
  margin-top: 4px;
}

/* ---- Region select overlay ---- */
.ba-region-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  cursor: crosshair;
  z-index: 99998;
}
.ba-region-rect {
  position: absolute;
  display: none;
  border: 2px dashed #fde047;
  background: rgba(253, 224, 71, 0.12);
  pointer-events: none;
}
.ba-region-help {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: #161b2c;
  color: #fff;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13px;
  border: 1px solid rgba(255,255,255,0.15);
}

/* ---- Annotator ---- */
.ba-annot-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.ba-annot-card {
  background: #161b2c;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 92vh;
  max-width: 96vw;
}
.ba-annot-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #e6e8ee;
  font-size: 13px;
}
.ba-annot-tools {
  display: flex;
  gap: 6px;
  align-items: center;
}
.ba-annot-color {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.25);
  cursor: pointer;
  padding: 0;
}
.ba-annot-color-active {
  outline: 2px solid #fff;
  outline-offset: 2px;
}
.ba-annot-tool-btn {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.12);
  color: #e6e8ee;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
}
.ba-annot-tool-btn:hover { background: rgba(255,255,255,0.10); }
.ba-annot-canvas-wrap {
  position: relative;
  display: inline-block;
  background: #000;
  border-radius: 6px;
  overflow: hidden;
  max-height: 75vh;
  overflow-y: auto;
}
.ba-annot-canvas-wrap img {
  display: block;
  pointer-events: none;
}
.ba-annot-canvas-wrap canvas {
  position: absolute;
  inset: 0;
  cursor: crosshair;
}
.ba-annot-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.ba-annot-attach {
  background: var(--ba-accent, #7c3aed);
  border: none;
  color: #fff;
  padding: 8px 18px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

/* ---- Quick suggestion chips inside the panel ---- */
#ba-shell .ba-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 12px 10px;
}

#ba-shell .ba-suggestions:empty { display: none; }

/* Revise bar — review-mode toggle + actions. Visible only when chibi is
   on an active email page. Sits between suggestions and screenshot preview
   so it's reachable without crowding the messages list. */
#ba-shell .ba-revise-bar {
  display: flex;
  gap: 8px;
  padding: 6px 12px 10px;
  border-top: 1px dashed var(--ba-border);
}
#ba-shell .ba-revise-bar.ba-hidden { display: none; }
#ba-shell .ba-review-actions {
  display: flex;
  gap: 6px;
  flex: 1;
}
#ba-shell .ba-review-actions.ba-hidden { display: none; }

#ba-shell .ba-start-review-btn,
#ba-shell .ba-regenerate-btn,
#ba-shell .ba-approve-btn,
#ba-shell .ba-end-review-btn {
  flex: 1;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  border: 1px solid color-mix(in srgb, var(--ba-accent) 50%, var(--ba-border));
}
#ba-shell .ba-start-review-btn {
  background: var(--ba-accent);
  color: #fff;
  border-color: var(--ba-accent);
}
#ba-shell .ba-start-review-btn:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
}
#ba-shell .ba-start-review-btn.ba-hidden { display: none; }

#ba-shell .ba-regenerate-btn {
  background: color-mix(in srgb, var(--ba-accent) 18%, transparent);
  color: var(--ba-text);
}
#ba-shell .ba-regenerate-btn:hover {
  background: color-mix(in srgb, var(--ba-accent) 32%, transparent);
}
#ba-shell .ba-approve-btn {
  background: var(--ba-accent);
  color: #fff;
  border-color: var(--ba-accent);
}
#ba-shell .ba-approve-btn:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
}
#ba-shell .ba-end-review-btn {
  background: transparent;
  color: var(--ba-text-2);
  border: 1px solid var(--ba-border);
  flex: 0 0 auto;
  padding: 8px 10px;
}
#ba-shell .ba-end-review-btn:hover {
  background: rgba(255,255,255,0.04);
  color: var(--ba-text);
}

/* Review-mode panel cue — subtle outer ring so the operator knows the
   chat is pinned open. */
#ba-shell .ba-panel.ba-review-mode {
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.55),
    0 0 0 6px color-mix(in srgb, var(--ba-accent) 22%, transparent),
    0 0 0 9px color-mix(in srgb, var(--ba-accent) 12%, transparent);
}

/* Quoted highlight on a sent message — looks like a reply preview in
   iMessage / Slack. Shows the passage the operator was pointing at when
   they hit send, so the chat reads as a clear "this comment was about
   this passage" thread. */
#ba-shell .ba-quoted-highlight {
  display: block;
  margin: 0 0 4px;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.04);
  border-left: 3px solid var(--ba-accent);
  border-radius: 4px;
  color: var(--ba-text-2);
  font-size: 11px;
  font-style: italic;
  line-height: 1.4;
  max-width: 100%;
  white-space: pre-wrap;
  word-break: break-word;
}
#ba-shell .ba-msg-user .ba-quoted-highlight {
  background: color-mix(in srgb, var(--ba-accent) 8%, transparent);
  color: color-mix(in srgb, var(--ba-text) 80%, var(--ba-accent));
  border-left-color: var(--ba-accent);
}

/* Highlight banner — shows the text the operator just selected on the
   page (or inside the iframe) while in review mode. Sits between the
   revise-bar and the screenshot preview. */
#ba-shell .ba-highlight-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 12px 8px;
  padding: 8px 10px;
  background: color-mix(in srgb, var(--ba-accent) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--ba-accent) 35%, var(--ba-border));
  border-left: 3px solid var(--ba-accent);
  border-radius: 8px;
  font-size: 12px;
}
#ba-shell .ba-highlight-banner.ba-hidden { display: none; }
#ba-shell .ba-highlight-label {
  color: var(--ba-accent);
  font-weight: 700;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  flex-shrink: 0;
}
#ba-shell .ba-highlight-text {
  color: var(--ba-text);
  flex: 1;
  font-style: italic;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#ba-shell .ba-chip {
  background: color-mix(in srgb, var(--ba-accent) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--ba-accent) 45%, transparent);
  color: var(--ba-text);
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  font-family: inherit;
}

#ba-shell .ba-chip:hover {
  background: color-mix(in srgb, var(--ba-accent) 28%, transparent);
  transform: translateY(-1px);
}

#ba-shell .ba-chip:active { transform: translateY(0); }
