/* =================================================================
   AI CHAT — REIzer Copilot floating launcher + chat panel (DP-6b)
   -----------------------------------------------------------------
   Auto-injected on every authenticated page by ai-chat.js. All
   selectors namespaced `.aic-*` so they don't collide with the
   in-page mockup in _index-sandbox-c.html or other UI.
   ================================================================= */

:root {
  --aic-z: 9000;
  /* Copilot accent: theme-aware green->teal gradient (rich in light, bright in
     dark) — distinct from the flat brand logo to signal the AI agent. */
  --aic-grad: linear-gradient(135deg, var(--accent) 0%, var(--accent-4) 100%);
}

/* ===========================================
   FLOATING LAUNCHER
   =========================================== */

.aic-launcher {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: var(--aic-z);
  display: none; /* shown by JS only when user is authed */
}
.aic-launcher.is-mounted { display: block; }
.aic-launcher.is-hidden  { display: none; }

.aic-launcher-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 0;
  background: var(--brand-fill);
  color: var(--brand-ink);
  cursor: pointer;
  box-shadow:
    0 8px 24px -8px color-mix(in srgb, var(--brand-fill) 55%, transparent),
    0 2px 6px color-mix(in srgb, var(--brand-fill) 22%, transparent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  position: relative;
}
/* AI-agent cue — a soft pulsing ring around the launcher (button only, not the
   chevron logo) to signal a live AI assistant. */
.aic-launcher-btn::after {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--brand-fill) 60%, transparent);
  opacity: 0;
  pointer-events: none;
  animation: aic-launcher-pulse 2.8s ease-out infinite;
}
@keyframes aic-launcher-pulse {
  0%   { transform: scale(0.9);  opacity: 0.6; }
  70%  { transform: scale(1.28); opacity: 0; }
  100% { opacity: 0; }
}
@media (prefers-reduced-motion: reduce) { .aic-launcher-btn::after { animation: none; } }
.aic-launcher-btn:hover {
  transform: translateY(-2px);
  box-shadow:
    0 12px 30px -8px color-mix(in srgb, var(--brand-fill) 65%, transparent),
    0 4px 10px color-mix(in srgb, var(--brand-fill) 25%, transparent);
}
.aic-launcher-btn svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.aic-launcher-tip {
  position: absolute;
  right: 70px;
  top: 50%;
  transform: translateY(-50%);
  background: #0f172a;
  color: var(--on-dark);
  padding: 7px 12px;
  border-radius: 8px;
  font-family: var(--font-display), sans-serif;
  font-size: 12.5px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
  box-shadow: 0 4px 12px rgba(0,0,0,0.18);
}
.aic-launcher-tip::after {
  content: '';
  position: absolute;
  right: -5px;
  top: 50%;
  transform: translateY(-50%) rotate(45deg);
  width: 10px;
  height: 10px;
  background: #0f172a;
}
.aic-launcher-btn:hover + .aic-launcher-tip,
.aic-launcher-btn:focus-visible + .aic-launcher-tip {
  opacity: 1;
}

/* ===========================================
   CHAT PANEL
   =========================================== */

.aic-panel {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: min(480px, calc(100vw - 48px));
  height: min(720px, calc(100vh - 48px));
  background: var(--surface-solid);
  border-radius: 16px;
  box-shadow:
    0 20px 50px -16px rgba(15,23,42,0.40),
    0 6px 18px -10px rgba(15,23,42,0.25);
  z-index: calc(var(--aic-z) + 1);
  display: none;
  flex-direction: column;
  overflow: hidden;
  font-family: var(--font-display), sans-serif;
  border: 1px solid rgba(15,23,42,0.08);
  transition: width 0.25s cubic-bezier(0.32, 0.72, 0, 1),
              height 0.25s cubic-bezier(0.32, 0.72, 0, 1);
}
.aic-panel.is-open { display: flex; }

/* ===========================================
   EMBEDDED (inline) MODE — dashboard home
   The same panel, re-parented into a host card and laid out as a
   static inline block instead of a floating overlay. Higher
   specificity (.aic-panel.aic-embedded) beats the fixed/mobile/docked
   rules regardless of source order. */
.aic-panel.aic-embedded {
  position: static;
  inset: auto;
  width: 100%;
  max-width: none;
  height: 560px;
  max-height: none;
  border-radius: 16px;
  border: 1px solid rgba(15,23,42,0.10);
  box-shadow: 0 14px 34px -22px rgba(15,23,42,0.30);
  transition: none;
}
.aic-panel.aic-embedded.is-open { display: flex; }
/* Inline chat lives in the card — there's nothing to close, and the
   dock animation doesn't apply. */
.aic-panel.aic-embedded [data-aic="close"] { display: none; }
@media (max-width: 900px) {
  .aic-panel.aic-embedded { height: 480px; }
}

/* Mobile / narrow — full-screen modal */
@media (max-width: 480px) {
  .aic-panel {
    bottom: 0;
    right: 0;
    left: 0;
    top: 0;
    width: 100%;
    /* 100vh counts the area BEHIND the mobile address bar, so the bottom
       input row (with the send button) was pushed off-screen. dvh tracks the
       actually-visible height; vh stays as a fallback for old browsers.
       The keyboard case is handled in JS (visualViewport) — see ai-chat.js
       syncPanelViewport(), which sets an explicit pixel height when open. */
    height: 100vh;
    height: 100dvh;
    border-radius: 0;
    max-height: none;
  }
  /* Keep the send button clear of the iOS home-indicator gesture bar. */
  .aic-input-bar {
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }
  .aic-launcher { bottom: 18px; right: 18px; }
}

/* Docked sidebar — VS-Code-style. Active on viewports wide enough
   that there's still room for the analyzer next to a 480px column.
   The chat panel becomes a full-height fixed right column; the rest
   of the page is pushed left via body padding so the analyzer's own
   side-panels (Comps overlay, MAO panel) shift to make room. */
@media (min-width: 1100px) {
  html.aic-docked body {
    padding-right: 480px;
    transition: padding-right 0.25s cubic-bezier(0.32, 0.72, 0, 1);
  }
  html.aic-docked .aic-panel {
    top: 0;
    right: 0;
    bottom: 0;
    width: 480px;
    height: 100vh;
    max-width: 480px;
    max-height: none;
    border-radius: 0;
    border: 0;
    border-left: 1px solid rgba(15,23,42,0.10);
    box-shadow: -16px 0 40px -22px rgba(15,23,42,0.20);
  }
  /* In-page side panels (MAO panel, analyzer results) are
     position:fixed; right:0 — push them left so the docked chat
     doesn't stack on top. */
  html.aic-docked .side-panel { right: 480px; }
  /* CompsOverlay is a full-viewport overlay (.strc-overlay {inset:0}),
     so we trim its right edge to land flush with the chat column.
     Same fix for any future inset-0 host. */
  html.aic-docked .strc-overlay {
    right: 480px !important;
    width: auto;
  }
}

/* --- Header — neutral surface, brand mark provides the gradient pop --- */
.aic-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--surface-solid);
  color: #0f172a;
  border-bottom: 1px solid rgba(15,23,42,0.08);
  flex-shrink: 0;
}
.aic-header-mark {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--brand-fill);
  color: var(--brand-ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.aic-header-mark svg {
  width: 16px;
  height: 16px;
}
.aic-header-title {
  flex: 1;
  min-width: 0;
}
.aic-header-h {
  font-weight: 700;
  font-size: 14.5px;
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: #0f172a;
}
.aic-header-sub {
  font-size: 11px;
  color: #64748b;
  letter-spacing: 0.02em;
  margin-top: 2px;
}

/* --- Quota ring + tooltip + popover --- */
.aic-quota-ring {
  position: relative;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: transparent;
  border: 0;
  cursor: pointer;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.aic-quota-ring svg.aic-ring {
  width: 26px;
  height: 26px;
  transform: rotate(-90deg);
  overflow: visible;
}
.aic-ring-bg {
  fill: none;
  stroke: rgba(15,23,42,0.12);
  stroke-width: 3;
}
.aic-ring-fg {
  fill: none;
  stroke: var(--accent);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 62.83;
  stroke-dashoffset: 62.83;
  transition: stroke-dashoffset 0.35s ease, stroke 0.2s ease;
}
.aic-quota-ring.is-low    .aic-ring-fg { stroke: var(--warn); }
.aic-quota-ring.is-blocked .aic-ring-fg { stroke: var(--neg); }
.aic-quota-ring.is-infinite .aic-ring-fg { stroke: var(--pos); }
.aic-quota-ring:hover .aic-ring-bg { stroke: rgba(15,23,42,0.20); }
.aic-quota-ring:focus-visible { outline: 2px solid rgba(126,232,106,0.40); outline-offset: 2px; }

.aic-quota-tip {
  position: absolute;
  top: 50%;
  right: calc(100% + 6px);
  transform: translateY(-50%);
  background: #0f172a;
  color: var(--on-dark);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.01em;
  padding: 5px 9px;
  border-radius: 6px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease;
  z-index: 2;
  font-variant-numeric: tabular-nums;
}
.aic-quota-ring:hover .aic-quota-tip { opacity: 1; }

/* Popover hangs below the actions, contained within the panel */
.aic-quota-pop {
  position: absolute;
  top: 56px;
  right: 12px;
  width: 280px;
  background: var(--surface-solid);
  border-radius: 12px;
  border: 1px solid rgba(15,23,42,0.10);
  box-shadow: 0 16px 36px -10px rgba(15,23,42,0.35);
  padding: 18px;
  z-index: 5;
  display: none;
}
.aic-quota-pop.is-open { display: block; }
.aic-quota-pop-kicker {
  font-size: 11px;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 8px;
}
.aic-quota-pop-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 12px;
}
.aic-quota-pop-big {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.02em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.aic-quota-pop-of {
  font-size: 13px;
  color: #64748b;
  font-variant-numeric: tabular-nums;
}
.aic-quota-pop-of strong { color: #0f172a; font-weight: 700; }
.aic-quota-pop-bar {
  height: 6px;
  background: rgba(15,23,42,0.08);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 10px;
}
.aic-quota-pop-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-3) 60%, var(--accent-4) 100%);
  width: 0%;
  transition: width 0.35s ease, background 0.2s ease;
  border-radius: 3px;
}
.aic-quota-pop.is-low    .aic-quota-pop-bar-fill { background: var(--warn); }
.aic-quota-pop.is-blocked .aic-quota-pop-bar-fill { background: var(--neg); }
.aic-quota-pop-meta {
  font-size: 12px;
  color: #64748b;
  line-height: 1.5;
}
.aic-quota-pop-meta strong { color: #0f172a; font-weight: 600; }
.aic-quota-pop-note {
  margin-top: 12px;
  padding: 10px 12px;
  background: rgba(245,158,11,0.08);
  border: 1px solid rgba(245,158,11,0.25);
  color: var(--warn-strong);
  font-size: 12px;
  line-height: 1.5;
  border-radius: 8px;
}
.aic-quota-pop-cta {
  display: block;
  margin-top: 12px;
  text-align: center;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-3) 100%);
  color: var(--on-dark) !important;
  border-radius: 8px;
  padding: 9px 12px;
  text-decoration: none !important;
  font-size: 13px;
  font-weight: 600;
  transition: transform 0.12s ease;
}
.aic-quota-pop-cta:hover { transform: translateY(-1px); }

/* Soft-throttle / over-quota banner between header and stream */
.aic-banner {
  display: none;
  padding: 8px 14px;
  font-size: 12.5px;
  line-height: 1.45;
  text-align: center;
  border-bottom: 1px solid transparent;
}
.aic-banner.is-on { display: block; }
.aic-banner-throttle {
  background: rgba(245,158,11,0.08);
  color: var(--warn-strong);
  border-bottom-color: rgba(245,158,11,0.20);
}
.aic-banner-throttle a {
  color: var(--warn-strong);
  font-weight: 700;
  text-decoration: underline;
}
.aic-header-actions {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
}
.aic-header-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 0;
  background: transparent;
  color: var(--ink-4);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease;
}
.aic-header-btn:hover {
  background: rgba(15,23,42,0.06);
  color: var(--ink-3);
}
.aic-header-btn svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* --- Message stream --- */
.aic-stream {
  flex: 1;
  overflow-y: auto;
  padding: 20px 18px 16px;
  background: #fafbfd;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scroll-behavior: smooth;
}
/* Slim, arrow-less scrollbars across the whole panel — covers the
   message stream's vertical scroll, the textarea's vertical scroll,
   and horizontal scrolls on wide <pre>/<table> blocks. ::-webkit-
   scrollbar-button: none hides the up/down/left/right arrow buttons
   that the OS-default scrollbar renders. */
.aic-panel,
.aic-panel * {
  scrollbar-width: thin;
  scrollbar-color: rgba(15,23,42,0.22) transparent;
}
.aic-panel ::-webkit-scrollbar,
.aic-panel::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
.aic-panel ::-webkit-scrollbar-track,
.aic-panel::-webkit-scrollbar-track {
  background: transparent;
}
.aic-panel ::-webkit-scrollbar-thumb,
.aic-panel::-webkit-scrollbar-thumb {
  background: rgba(15,23,42,0.20);
  border-radius: 4px;
}
.aic-panel ::-webkit-scrollbar-thumb:hover,
.aic-panel::-webkit-scrollbar-thumb:hover {
  background: rgba(15,23,42,0.36);
}
.aic-panel ::-webkit-scrollbar-button,
.aic-panel::-webkit-scrollbar-button {
  display: none;
  width: 0;
  height: 0;
}
.aic-panel ::-webkit-scrollbar-corner,
.aic-panel::-webkit-scrollbar-corner {
  background: transparent;
}

.aic-msg {
  display: flex;
  gap: 10px;
  max-width: 100%;
}
.aic-msg-user { justify-content: flex-end; }

.aic-bubble {
  max-width: 84%;
  padding: 11px 14px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.55;
  word-wrap: break-word;
  overflow-wrap: break-word;
  background: var(--surface-solid);
  color: #1f2937;
  border: 1px solid rgba(15,23,42,0.08);
  box-shadow: 0 1px 2px rgba(15,23,42,0.04);
}
.aic-msg-ai .aic-bubble {
  border-radius: 12px 12px 12px 4px;
}
.aic-msg-user .aic-bubble {
  border-radius: 12px 12px 4px 12px;
}

/* Markdown styles inside AI bubble */
.aic-bubble > *:first-child { margin-top: 0; }
.aic-bubble > *:last-child  { margin-bottom: 0; }
.aic-bubble h1,
.aic-bubble h2,
.aic-bubble h3,
.aic-bubble h4 {
  font-weight: 700;
  line-height: 1.25;
  margin: 14px 0 6px;
  color: #0f172a;
}
.aic-bubble h1 { font-size: 17px; }
.aic-bubble h2 { font-size: 16px; }
.aic-bubble h3 { font-size: 14.5px; }
.aic-bubble h4 { font-size: 13.5px; }
.aic-bubble p { margin: 8px 0; }
.aic-bubble ul,
.aic-bubble ol {
  margin: 8px 0;
  padding-left: 22px;
}
.aic-bubble li { margin: 3px 0; }
.aic-bubble strong { color: #0f172a; font-weight: 700; }
.aic-bubble em     { font-style: italic; }
.aic-bubble code {
  font-family: var(--font-mono), monospace;
  font-size: 12.5px;
  background: rgba(126,232,106,0.10);
  color: var(--accent-strong);
  padding: 1px 6px;
  border-radius: 4px;
}
.aic-bubble pre {
  background: #0f172a;
  color: var(--line);
  padding: 12px 14px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 10px 0;
  font-size: 12.5px;
  line-height: 1.5;
}
.aic-bubble pre code {
  background: transparent;
  color: inherit;
  padding: 0;
  border-radius: 0;
  font-size: inherit;
}
/* Tables — wrap in a scroll container so wide tables don't blow out
   the chat panel. The wrapping happens via the parent .aic-bubble
   which we keep at max-width 84%; the table itself gets a min-width
   so columns don't collapse, but overflow-x scrolls horizontally. */
.aic-bubble table {
  border-collapse: collapse;
  margin: 10px 0;
  display: block;
  width: 100%;
  overflow-x: auto;
  font-size: 12.5px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
.aic-bubble th,
.aic-bubble td {
  border: 1px solid rgba(15,23,42,0.10);
  padding: 6px 10px;
  text-align: left;
  white-space: nowrap;
}
.aic-bubble th {
  background: rgba(126,232,106,0.07);
  font-weight: 700;
}
/* Strikethrough — keep it readable rather than making text look
   "deleted". Used by the model when contrasting an alternate value
   with the user's actual entry. */
.aic-bubble del,
.aic-bubble s {
  text-decoration: line-through;
  text-decoration-color: rgba(15,23,42,0.30);
  text-decoration-thickness: 1px;
  color: var(--ink-3);
  opacity: 0.85;
}
.aic-bubble blockquote {
  border-left: 3px solid var(--accent-3);
  margin: 10px 0;
  padding: 8px 14px;
  background: rgba(126,232,106,0.06);
  border-radius: 0 8px 8px 0;
  color: var(--ink-3);
}
/* Warning-style blockquote — when the model opens a blockquote with
   ⚠️ it's asking for confirmation of a paid / side-effecting action.
   Standout colors so the user immediately reads it as actionable. */
.aic-bubble blockquote:has(strong:first-of-type) {
  /* fallback styling for non-:has browsers handled by .is-confirm below */
}
.aic-bubble blockquote.aic-confirm,
.aic-bubble blockquote {
  /* Heuristic: blockquotes starting with the warning emoji get the
     warning treatment. Cleaner than :has() and works everywhere. */
}
.aic-bubble blockquote {
  border-left-color: var(--accent-3);
}
/* Override when the first text content includes the warning emoji.
   We use an :is() selector chain so the rule fires on any descendant
   <strong> matching either pattern. */
.aic-bubble blockquote p:first-child:first-letter {
  /* no-op anchor */
}
/* Real warning style — applied via JS when the bubble is finalized
   if its blockquotes start with ⚠️. */
.aic-bubble blockquote.is-warn {
  border-left: 3px solid var(--warn);
  background: rgba(245,158,11,0.10);
  color: var(--warn-strong);
}
.aic-bubble blockquote.is-warn strong { color: #78350f; }
html[data-theme="dark"] .aic-bubble blockquote.is-warn,
html[data-theme="midnight"] .aic-bubble blockquote.is-warn {
  background: rgba(245,158,11,0.14);
  color: var(--warn);
  border-left-color: var(--warn);
}
html[data-theme="dark"] .aic-bubble blockquote.is-warn strong,
html[data-theme="midnight"] .aic-bubble blockquote.is-warn strong { color: #fde68a; }
.aic-bubble a {
  color: var(--accent);
  text-decoration: underline;
}
.aic-bubble hr {
  border: 0;
  border-top: 1px solid rgba(15,23,42,0.10);
  margin: 12px 0;
}

/* Streaming caret */
.aic-bubble.is-streaming::after {
  content: '';
  display: inline-block;
  width: 2px;
  height: 1em;
  background: currentColor;
  vertical-align: -2px;
  margin-left: 3px;
  animation: aic-caret 0.9s steps(2) infinite;
  opacity: 0.7;
}
@keyframes aic-caret { 50% { opacity: 0; } }

/* REIzer chevron mark — the brand logo shared by launcher, header,
   welcome state, and thinking bubble. Spins in place when its parent
   carries the .is-thinking class. svg.aic-roof selector (specificity
   0,1,1) overrides the more general .aic-launcher-btn svg etc. rules
   so the chevron gets a heavier stroke than the close/clear/send
   icons. Sizing comes from each parent container. */
svg.aic-roof {
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
/* Spin only the chevron inside the in-stream thinking bubble. The
   header mark stays static — keeping the brand calm in the chrome. */
.aic-thinking-mark.is-thinking > .aic-roof {
  animation: aic-roof-spin 2.4s cubic-bezier(.65,.05,.25,1) infinite;
  transform-origin: 50% 50%;
}
@keyframes aic-roof-spin {
  0%   { transform: rotate(0deg);   }
  50%  { transform: rotate(360deg); }
  100% { transform: rotate(360deg); }
}

/* DP-6e — Tool-running inline pill (e.g. "Pulling property comps…") */
.aic-tool {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  padding: 9px 14px 9px 10px;
  background: rgba(126,232,106,0.06);
  border: 1px solid rgba(126,232,106,0.20);
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--accent-strong);
  font-family: var(--font-display), sans-serif;
}
.aic-tool-mark {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--brand-fill);
  color: var(--brand-ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.aic-tool-mark .aic-roof { width: 10px; height: 10px; }
.aic-tool-label { line-height: 1.3; }
.aic-tool.is-ok {
  background: rgba(16,185,129,0.06);
  border-color: rgba(16,185,129,0.25);
  color: var(--pos-strong);
}
.aic-tool.is-ok .aic-tool-mark { background: var(--pos); }
.aic-tool.is-error {
  background: rgba(239,68,68,0.06);
  border-color: rgba(239,68,68,0.25);
  color: var(--neg-strong);
}
.aic-tool.is-error .aic-tool-mark { background: var(--neg); }
html[data-theme="dark"] .aic-tool,
html[data-theme="midnight"] .aic-tool {
  background: rgba(126,232,106,0.10);
  border-color: rgba(126,232,106,0.25);
  color: var(--accent-3);
}
html[data-theme="dark"] .aic-tool.is-ok,
html[data-theme="midnight"] .aic-tool.is-ok {
  background: rgba(16,185,129,0.12);
  border-color: rgba(16,185,129,0.30);
  color: #6ee7b7;
}
html[data-theme="dark"] .aic-tool.is-error,
html[data-theme="midnight"] .aic-tool.is-error {
  background: rgba(239,68,68,0.12);
  border-color: rgba(239,68,68,0.30);
  color: #fca5a5;
}

/* =================================================================
   Phase A viz — sentiment-colored numbers + structured tool cards
================================================================= */
/* Signed numbers in AI answers (incl. inside tables): green = positive
   money / return, red = negative. Applied by enhanceBubble() on finalize. */
.aic-num.is-pos { color: var(--pos-strong); font-weight: 600; }
.aic-num.is-neg { color: var(--neg-strong); font-weight: 600; }
html[data-theme="dark"] .aic-num.is-pos,
html[data-theme="midnight"] .aic-num.is-pos { color: #6ee7b7; }
html[data-theme="dark"] .aic-num.is-neg,
html[data-theme="midnight"] .aic-num.is-neg { color: #fca5a5; }

/* Structured tool-result card — replaces the one-line pill for tools
   that return useful structured data (MAO solver, property comps). */
.aic-toolcard {
  display: inline-block;
  min-width: 210px;
  max-width: 100%;
  background: rgba(16,185,129,0.05);
  border: 1px solid rgba(16,185,129,0.22);
  border-radius: 12px;
  padding: 10px 12px;
  font-family: var(--font-display), sans-serif;
}
.aic-tc-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.aic-tc-icon { font-size: 14px; line-height: 1; }
.aic-tc-title { font-size: 12.5px; font-weight: 700; color: var(--pos-strong); }
.aic-tc-body { display: flex; flex-direction: column; gap: 5px; }
.aic-tc-metric { display: flex; justify-content: space-between; gap: 16px; font-size: 12.5px; }
.aic-tc-k { color: var(--ink-3); }
.aic-tc-v { font-weight: 700; color: #0f172a; font-variant-numeric: tabular-nums; }
html[data-theme="dark"] .aic-toolcard,
html[data-theme="midnight"] .aic-toolcard {
  background: rgba(16,185,129,0.10);
  border-color: rgba(16,185,129,0.28);
}
html[data-theme="dark"] .aic-tc-title,
html[data-theme="midnight"] .aic-tc-title { color: #6ee7b7; }
html[data-theme="dark"] .aic-tc-k,
html[data-theme="midnight"] .aic-tc-k { color: var(--ink-3); }
html[data-theme="dark"] .aic-tc-v,
html[data-theme="midnight"] .aic-tc-v { color: #e2e8f0; }

/* Market Trends leaderboard (rank_markets) — ranked bar list */
.aic-leaderboard { display: block; width: 100%; min-width: 240px; }
.aic-lb-body { display: flex; flex-direction: column; gap: 6px; margin-top: 2px; }
.aic-lb-row {
  display: grid;
  grid-template-columns: 16px 104px 1fr auto;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}
.aic-lb-rank { color: var(--ink-3); font-variant-numeric: tabular-nums; text-align: right; font-weight: 600; }
.aic-lb-name { color: #0f172a; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.aic-lb-bar { height: 7px; border-radius: 999px; background: rgba(16,185,129,0.12); overflow: hidden; }
.aic-lb-bar > span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #9bdb7e, #1f7a32); }
.aic-lb-val { font-weight: 700; color: #0f172a; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.aic-lb-foot { margin-top: 8px; font-size: 10.5px; color: var(--ink-3); }
html[data-theme="dark"] .aic-lb-name, html[data-theme="midnight"] .aic-lb-name,
html[data-theme="dark"] .aic-lb-val,  html[data-theme="midnight"] .aic-lb-val { color: #e2e8f0; }
html[data-theme="dark"] .aic-lb-bar,  html[data-theme="midnight"] .aic-lb-bar { background: rgba(16,185,129,0.18); }

/* Property comps list (pull_property_comps) */
.aic-comps { display: block; min-width: 244px; }
.aic-complist {
  margin-top: 9px;
  padding-top: 8px;
  border-top: 1px solid rgba(16,185,129,0.16);
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.aic-complist-h {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 1px;
}
.aic-comp-row {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas: "addr price" "meta meta";
  gap: 1px 8px;
  font-size: 11.5px;
}
.aic-comp-addr { grid-area: addr; color: #0f172a; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.aic-comp-price { grid-area: price; font-weight: 700; color: var(--pos-strong); font-variant-numeric: tabular-nums; white-space: nowrap; }
.aic-comp-meta { grid-area: meta; color: var(--ink-3); font-size: 10.5px; font-variant-numeric: tabular-nums; }
html[data-theme="dark"] .aic-comp-addr, html[data-theme="midnight"] .aic-comp-addr { color: #e2e8f0; }

/* Compact nav confirmation chip (open_tool) */
.aic-navchip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  background: rgba(126,232,106,0.08);
  border: 1px solid rgba(126,232,106,0.22);
  border-radius: 999px;
  font-size: 12.5px;
  color: var(--accent-strong);
  font-family: var(--font-display), sans-serif;
}
.aic-navchip-arrow { font-weight: 700; }
.aic-navchip strong { font-weight: 700; }
html[data-theme="dark"] .aic-navchip,
html[data-theme="midnight"] .aic-navchip {
  background: rgba(126,232,106,0.14);
  border-color: rgba(126,232,106,0.30);
  color: var(--accent-3);
}

/* Deal-score gauge — half-circle, rendered in chat on "analyze this deal".
   Matches the on-page DealScore gauge bands. */
/* Metric-tile grid (rei:tiles) — at-a-glance analyze-this-deal numbers */
.aic-tiles {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin: 10px 0;
}
.aic-tile {
  background: rgba(16,185,129,0.05);
  border: 1px solid rgba(16,185,129,0.18);
  border-radius: 10px;
  padding: 9px 11px;
  min-width: 0;
}
.aic-tile-k {
  font-size: 10.5px;
  color: var(--ink-3);
  letter-spacing: 0.02em;
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.aic-tile-v {
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
  font-variant-numeric: tabular-nums;
}
.aic-tile-v.is-neg { color: var(--neg-strong, #dc2626); }
html[data-theme="dark"] .aic-tile,
html[data-theme="midnight"] .aic-tile {
  background: rgba(16,185,129,0.09);
  border-color: rgba(16,185,129,0.22);
}
html[data-theme="dark"] .aic-tile-v,
html[data-theme="midnight"] .aic-tile-v { color: #e2e8f0; }

.aic-gauge {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  margin: 12px 0;
  padding: 12px 14px 10px;
  background: rgba(15,23,42,0.03);
  border: 1px solid rgba(15,23,42,0.08);
  border-radius: 14px;
}
.aic-gauge-title {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #64748b;
  text-align: center;
  margin-bottom: 2px;
}
.aic-gauge-svg {
  width: 216px;
  max-width: 100%;
  height: auto;
  display: block;
}
.aic-gauge-score {
  font-family: var(--font-display), sans-serif;
  font-size: 38px;
  font-weight: 800;
}
.aic-gauge-band {
  font-family: var(--font-display), sans-serif;
  font-size: 13px;
  font-weight: 700;
  fill: var(--ink-3);
}
.aic-gauge-scale {
  display: flex;
  justify-content: space-between;
  width: 196px;
  max-width: 100%;
  margin-top: -6px;
  font-size: 10.5px;
  color: var(--ink-4);
  font-variant-numeric: tabular-nums;
}
html[data-theme="dark"] .aic-gauge,
html[data-theme="midnight"] .aic-gauge {
  background: rgba(255,255,255,0.03);
  border-color: rgba(255,255,255,0.08);
}
html[data-theme="dark"] .aic-gauge-band,
html[data-theme="midnight"] .aic-gauge-band { fill: var(--ink-2); }
html[data-theme="dark"] .aic-gauge-title,
html[data-theme="midnight"] .aic-gauge-title { color: var(--ink-3); }

/* Thinking bubble — REIzer mark + "Thinking" + dots */
.aic-thinking {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  padding: 11px 16px 11px 11px;
  background: var(--surface-solid);
  border-radius: 14px 14px 14px 4px;
  border: 1px solid rgba(15,23,42,0.08);
  box-shadow: 0 1px 2px rgba(15,23,42,0.04);
}
.aic-thinking-mark {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--brand-fill);
  color: var(--brand-ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.aic-thinking-mark .aic-roof {
  width: 13px;
  height: 13px;
}
.aic-thinking-text {
  font-size: 13.5px;
  color: var(--ink-3);
  font-weight: 500;
}
.aic-thinking-dots {
  display: inline-flex;
  gap: 4px;
}
.aic-thinking-dots span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--ink-4);
  animation: aic-bounce 1.4s ease-in-out infinite both;
}
.aic-thinking-dots span:nth-child(1) { animation-delay: -0.32s; }
.aic-thinking-dots span:nth-child(2) { animation-delay: -0.16s; }
@keyframes aic-bounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
  40%           { transform: scale(1);   opacity: 1;   }
}

/* Empty / welcome state */
.aic-welcome {
  text-align: center;
  padding: 32px 18px 12px;
  color: var(--ink-3);
}
.aic-welcome-mark {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--brand-fill);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--brand-ink);
  margin-bottom: 12px;
  box-shadow: 0 6px 18px -6px rgba(126,232,106,0.5);
}
.aic-welcome-mark svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.aic-welcome-h {
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 4px;
}
.aic-welcome-p {
  font-size: 13.5px;
  line-height: 1.55;
  margin: 0;
}
.aic-suggestions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 18px;
  padding: 0 6px;
}
.aic-suggest-btn {
  text-align: left;
  font-family: inherit;
  font-size: 13px;
  background: var(--surface-solid);
  border: 1px solid rgba(15,23,42,0.10);
  border-radius: 10px;
  padding: 9px 13px;
  cursor: pointer;
  color: #334155;
  transition: border-color 0.18s ease, color 0.18s ease, background 0.18s ease,
              box-shadow 0.18s ease, transform 0.18s ease;
}
/* Soft bright-green glow around the frame on hover — no fill. */
.aic-suggest-btn:hover {
  border-color: rgba(126,232,106,0.55);
  color: #0f172a;
  box-shadow: 0 0 0 3px rgba(126,232,106,0.14),
              0 10px 24px -12px rgba(126,232,106,0.55);
  transform: translateY(-1px);
}

/* Inline error banner */
.aic-error {
  background: rgba(239,68,68,0.08);
  border: 1px solid rgba(239,68,68,0.30);
  color: var(--neg-strong);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.5;
}
.aic-error a {
  color: inherit;
  text-decoration: underline;
  font-weight: 600;
}

/* --- Input bar --- */
.aic-input-bar {
  border-top: 1px solid rgba(15,23,42,0.08);
  padding: 12px 14px;
  background: var(--surface-solid);
  display: flex;
  align-items: flex-end;
  gap: 8px;
  flex-shrink: 0;
}
.aic-input {
  flex: 1;
  border: 1px solid rgba(126,232,106,0.30);
  background: var(--bg);
  border-radius: 10px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 14px;
  color: #1f2937;
  resize: none;
  outline: none;
  line-height: 1.45;
  max-height: 140px;
  overflow-y: auto;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}
/* Soft bright-green glow on focus rather than a flat dark-green ring. */
.aic-input:focus {
  border-color: rgba(126,232,106,0.70);
  background: var(--surface-solid);
  box-shadow: 0 0 0 3px rgba(126,232,106,0.16),
              0 6px 20px -10px rgba(126,232,106,0.55);
}
.aic-input::placeholder { color: var(--ink-4); }
.aic-input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.aic-send {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 0;
  background: var(--brand-fill);
  color: var(--brand-ink);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.12s ease, opacity 0.15s ease;
}
.aic-send:hover:not(:disabled) { transform: translateY(-1px); }
.aic-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.aic-send svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.aic-footnote {
  text-align: center;
  font-size: 10.5px;
  color: var(--ink-4);
  padding: 6px 12px 8px;
  background: var(--surface-solid);
  border-top: 1px solid rgba(15,23,42,0.04);
}

/* ===========================================
   DARK / MIDNIGHT theme
   =========================================== */

html[data-theme="dark"] .aic-panel,
html[data-theme="midnight"] .aic-panel {
  background: #0f172a;
  border-color: rgba(126,232,106,0.18);
}
html[data-theme="dark"] .aic-header,
html[data-theme="midnight"] .aic-header {
  background: #111c33;
  color: var(--ink);
  border-bottom-color: rgba(126,232,106,0.18);
}
html[data-theme="dark"] .aic-header-h,
html[data-theme="midnight"] .aic-header-h { color: var(--ink); }
html[data-theme="dark"] .aic-header-sub,
html[data-theme="midnight"] .aic-header-sub { color: var(--ink-3); }
html[data-theme="dark"] .aic-ring-bg,
html[data-theme="midnight"] .aic-ring-bg { stroke: rgba(255,255,255,0.14); }
html[data-theme="dark"] .aic-quota-ring:hover .aic-ring-bg,
html[data-theme="midnight"] .aic-quota-ring:hover .aic-ring-bg { stroke: rgba(255,255,255,0.24); }
html[data-theme="dark"] .aic-quota-pop,
html[data-theme="midnight"] .aic-quota-pop {
  background: #1e293b;
  border-color: rgba(126,232,106,0.20);
  box-shadow: 0 16px 36px -10px rgba(0,0,0,0.55);
}
html[data-theme="midnight"] .aic-quota-pop { background: #141414; border-color: var(--line-2); }
html[data-theme="dark"] .aic-quota-pop-big,
html[data-theme="midnight"] .aic-quota-pop-big { color: var(--ink); }
html[data-theme="dark"] .aic-quota-pop-of,
html[data-theme="dark"] .aic-quota-pop-meta,
html[data-theme="midnight"] .aic-quota-pop-of,
html[data-theme="midnight"] .aic-quota-pop-meta { color: var(--ink-3); }
html[data-theme="dark"] .aic-quota-pop-of strong,
html[data-theme="dark"] .aic-quota-pop-meta strong,
html[data-theme="midnight"] .aic-quota-pop-of strong,
html[data-theme="midnight"] .aic-quota-pop-meta strong { color: var(--ink); }
html[data-theme="dark"] .aic-quota-pop-bar,
html[data-theme="midnight"] .aic-quota-pop-bar { background: rgba(255,255,255,0.10); }
html[data-theme="dark"] .aic-quota-pop-note,
html[data-theme="midnight"] .aic-quota-pop-note {
  background: rgba(245,158,11,0.12);
  color: var(--warn);
  border-color: rgba(245,158,11,0.28);
}
html[data-theme="dark"] .aic-banner-throttle,
html[data-theme="midnight"] .aic-banner-throttle {
  background: rgba(245,158,11,0.12);
  color: var(--warn);
  border-bottom-color: rgba(245,158,11,0.25);
}
html[data-theme="dark"] .aic-banner-throttle a,
html[data-theme="midnight"] .aic-banner-throttle a { color: var(--warn); }
html[data-theme="dark"] .aic-header-btn,
html[data-theme="midnight"] .aic-header-btn { color: var(--ink-4); }
html[data-theme="dark"] .aic-header-btn:hover,
html[data-theme="midnight"] .aic-header-btn:hover {
  background: rgba(255,255,255,0.06);
  color: var(--ink-2);
}
html[data-theme="dark"] .aic-stream,
html[data-theme="midnight"] .aic-stream {
  background: #0b1325;
}
html[data-theme="dark"] .aic-bubble,
html[data-theme="midnight"] .aic-bubble {
  background: #1e293b;
  color: #e2e8f0;
  border-color: rgba(126,232,106,0.18);
}
html[data-theme="dark"] .aic-bubble h1,
html[data-theme="dark"] .aic-bubble h2,
html[data-theme="dark"] .aic-bubble h3,
html[data-theme="dark"] .aic-bubble h4,
html[data-theme="dark"] .aic-bubble strong,
html[data-theme="midnight"] .aic-bubble h1,
html[data-theme="midnight"] .aic-bubble h2,
html[data-theme="midnight"] .aic-bubble h3,
html[data-theme="midnight"] .aic-bubble h4,
html[data-theme="midnight"] .aic-bubble strong { color: var(--ink); }
html[data-theme="dark"] .aic-bubble code,
html[data-theme="midnight"] .aic-bubble code {
  background: rgba(126,232,106,0.18);
  color: var(--accent-3);
}
html[data-theme="dark"] .aic-thinking,
html[data-theme="midnight"] .aic-thinking {
  background: #1e293b;
  border-color: rgba(126,232,106,0.18);
}
html[data-theme="dark"] .aic-input-bar,
html[data-theme="midnight"] .aic-input-bar {
  background: #0f172a;
  border-top-color: rgba(126,232,106,0.15);
}
html[data-theme="dark"] .aic-input,
html[data-theme="midnight"] .aic-input {
  background: #1e293b;
  color: var(--ink);
  border-color: rgba(126,232,106,0.20);
}
html[data-theme="dark"] .aic-input:focus,
html[data-theme="midnight"] .aic-input:focus {
  background: #0f172a;
}
html[data-theme="dark"] .aic-welcome,
html[data-theme="midnight"] .aic-welcome { color: var(--ink-3); }
html[data-theme="dark"] .aic-welcome-h,
html[data-theme="midnight"] .aic-welcome-h { color: var(--ink); }
html[data-theme="dark"] .aic-suggest-btn,
html[data-theme="midnight"] .aic-suggest-btn {
  background: #1e293b;
  color: var(--ink-2);
  border-color: rgba(126,232,106,0.25);
}
html[data-theme="dark"] .aic-suggest-btn:hover,
html[data-theme="midnight"] .aic-suggest-btn:hover {
  background: rgba(126,232,106,0.12);
  color: var(--accent-3);
}
html[data-theme="dark"] .aic-footnote,
html[data-theme="midnight"] .aic-footnote {
  background: #0f172a;
  color: var(--ink-4);
  border-top-color: rgba(126,232,106,0.10);
}

/* Scrollbars — dark + midnight (both inherit a brighter thumb) */
html[data-theme="dark"] .aic-panel,
html[data-theme="dark"] .aic-panel *,
html[data-theme="midnight"] .aic-panel,
html[data-theme="midnight"] .aic-panel * {
  scrollbar-color: rgba(255,255,255,0.20) transparent;
}
html[data-theme="dark"] .aic-panel ::-webkit-scrollbar-thumb,
html[data-theme="dark"] .aic-panel::-webkit-scrollbar-thumb,
html[data-theme="midnight"] .aic-panel ::-webkit-scrollbar-thumb,
html[data-theme="midnight"] .aic-panel::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.18);
}
html[data-theme="dark"] .aic-panel ::-webkit-scrollbar-thumb:hover,
html[data-theme="dark"] .aic-panel::-webkit-scrollbar-thumb:hover,
html[data-theme="midnight"] .aic-panel ::-webkit-scrollbar-thumb:hover,
html[data-theme="midnight"] .aic-panel::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,0.32);
}

/* =================================================================
   MIDNIGHT theme — true black surfaces, OLED-friendly. Overrides
   the dark/midnight shared rules above (same specificity, later
   source order). Variable names mirror the global theme.css palette
   for visual consistency with the rest of the app.
   ================================================================= */
html[data-theme="midnight"] .aic-panel {
  background: var(--surface-2);
  border-color: var(--line);
}
html[data-theme="midnight"] .aic-header {
  background: #0f0f0f;
  border-bottom-color: var(--line);
}
html[data-theme="midnight"] .aic-header-h { color: var(--ink); }
html[data-theme="midnight"] .aic-header-sub { color: var(--ink-3); }
html[data-theme="midnight"] .aic-header-btn { color: var(--ink-4); }
html[data-theme="midnight"] .aic-header-btn:hover {
  background: rgba(255,255,255,0.05);
  color: var(--ink-2);
}
html[data-theme="midnight"] .aic-stream {
  background: var(--bg);
}
html[data-theme="midnight"] .aic-bubble {
  background: #141414;
  color: var(--ink-2);
  border-color: var(--line-2);
}
html[data-theme="midnight"] .aic-bubble h1,
html[data-theme="midnight"] .aic-bubble h2,
html[data-theme="midnight"] .aic-bubble h3,
html[data-theme="midnight"] .aic-bubble h4,
html[data-theme="midnight"] .aic-bubble strong { color: var(--ink); }
html[data-theme="midnight"] .aic-bubble code {
  background: rgba(126,232,106,0.16);
  color: var(--accent-3);
}
html[data-theme="midnight"] .aic-bubble pre {
  background: #050505;
  color: var(--ink-2);
  border: 1px solid var(--line);
}
html[data-theme="midnight"] .aic-bubble th,
html[data-theme="midnight"] .aic-bubble td {
  border-color: var(--line-2);
}
html[data-theme="midnight"] .aic-bubble th {
  background: rgba(126,232,106,0.10);
}
html[data-theme="midnight"] .aic-bubble blockquote {
  color: var(--ink-3);
}
html[data-theme="midnight"] .aic-bubble a { color: var(--accent-3); }
html[data-theme="midnight"] .aic-thinking {
  background: #141414;
  border-color: var(--line-2);
}
html[data-theme="midnight"] .aic-thinking-text { color: var(--ink-3); }
html[data-theme="midnight"] .aic-input-bar {
  background: var(--surface-2);
  border-top-color: var(--line);
}
html[data-theme="midnight"] .aic-input {
  background: #141414;
  color: var(--ink);
  border-color: var(--line-2);
}
html[data-theme="midnight"] .aic-input:focus {
  background: var(--surface-2);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(126,232,106,0.18);
}
html[data-theme="midnight"] .aic-welcome { color: var(--ink-3); }
html[data-theme="midnight"] .aic-welcome-h { color: var(--ink); }
html[data-theme="midnight"] .aic-suggest-btn {
  background: #141414;
  color: #d4d4d4;
  border-color: var(--line-2);
}
html[data-theme="midnight"] .aic-suggest-btn:hover {
  background: rgba(126,232,106,0.10);
  color: var(--accent-3);
  border-color: var(--accent);
}
html[data-theme="midnight"] .aic-footnote {
  background: var(--surface-2);
  color: var(--ink-4);
  border-top-color: var(--line);
}
html[data-theme="midnight"] .aic-error {
  background: rgba(239,68,68,0.10);
  border-color: rgba(239,68,68,0.35);
  color: #fca5a5;
}
