/* MultiAI ChatBot — widget styles */

#multch-plugin-root,
#multch-style-preview,
.maicb-widget {
  --maicb-primary: #2563eb;
  --maicb-accent: #7c3aed;
  --maicb-bg: #ffffff;
  --maicb-fg: #0f172a;
  --maicb-muted: #64748b;
  --maicb-border: rgba(15, 23, 42, 0.12);
  --maicb-card: rgba(255, 255, 255, 0.95);
  --maicb-radius: 1.5rem;
  --maicb-shadow: 0 18px 44px -18px rgba(15, 23, 42, 0.35);
  --maicb-offset: 1rem;
  --maicb-panel-width: min(380px, calc(100vw - 2rem));
  --maicb-panel-max-height: none;
  --maicb-z-base: 2147483645;
  --maicb-scrollbar-size: 6px;
  --maicb-scrollbar-size-input: 4px;
  --maicb-scrollbar-track: transparent;
  --maicb-scrollbar-thumb: color-mix(in srgb, var(--maicb-primary) 48%, var(--maicb-muted) 52%);
  --maicb-scrollbar-thumb-hover: color-mix(in srgb, var(--maicb-primary) 62%, var(--maicb-accent) 38%);
  --maicb-scrollbar-radius: 999px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  box-sizing: border-box;
}

/* Floating: capa a nivel viewport (evita recortes del footer/tema con transform u overflow) */
#multch-plugin-root[data-mode="floating"] {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  overflow: visible;
  pointer-events: none;
  z-index: var(--maicb-z-base);
  contain: none;
  isolation: isolate;
}

#multch-plugin-root[data-mode="floating"] .maicb-wrap {
  position: static;
  width: 0;
  height: 0;
  overflow: visible;
  pointer-events: none;
}

#multch-plugin-root[data-mode="floating"] .maicb-launcher,
#multch-plugin-root[data-mode="floating"] .maicb-panel {
  pointer-events: auto;
}

#multch-plugin-root[data-mode="inline"] {
  position: relative;
  display: block;
  width: 100%;
  max-width: 100%;
  margin: 1rem 0;
}

.maicb-widget *,
.maicb-widget *::before,
.maicb-widget *::after,
#multch-plugin-root *,
#multch-plugin-root *::before,
#multch-plugin-root *::after,
#multch-style-preview *,
#multch-style-preview *::before,
#multch-style-preview *::after {
  box-sizing: border-box;
}

/* Presets — each theme defines a full, coordinated palette */
.maicb-widget.maicb-preset-default,
#multch-plugin-root.maicb-preset-default,
#multch-style-preview.maicb-preset-default {
  --maicb-primary: #2563eb;
  --maicb-accent: #6366f1;
  --maicb-bg: #f8fafc;
  --maicb-fg: #0f172a;
  --maicb-muted: #64748b;
  --maicb-border: rgba(37, 99, 235, 0.12);
  --maicb-card: #ffffff;
  --maicb-header-bg: linear-gradient(135deg, rgba(37, 99, 235, 0.1) 0%, rgba(99, 102, 241, 0.06) 100%);
  --maicb-body-bg: linear-gradient(180deg, #eef2ff 0%, #f8fafc 55%, #f1f5f9 100%);
  --maicb-assistant-bg: #ffffff;
  --maicb-composer-bg: #ffffff;
  --maicb-radius: 1.25rem;
  --maicb-shadow: 0 22px 48px -16px rgba(37, 99, 235, 0.22);
  --maicb-launcher-glow: 0 10px 28px -6px rgba(37, 99, 235, 0.45);
}

.maicb-widget.maicb-preset-dark-glass,
#multch-plugin-root.maicb-preset-dark-glass,
#multch-style-preview.maicb-preset-dark-glass {
  --maicb-primary: #38bdf8;
  --maicb-accent: #a78bfa;
  --maicb-bg: #1e293b;
  --maicb-fg: #f8fafc;
  --maicb-muted: #b6c2d3;
  --maicb-border: rgba(148, 163, 184, 0.24);
  --maicb-card: rgba(15, 23, 42, 0.96);
  --maicb-header-bg: linear-gradient(135deg, #172554 0%, #0f172a 52%, #1e1b4b 100%);
  --maicb-header-title-color: #f8fafc;
  --maicb-header-sub-color: #cbd5e1;
  --maicb-body-bg: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
  --maicb-assistant-bg: rgba(51, 65, 85, 0.88);
  --maicb-composer-bg: rgba(15, 23, 42, 0.98);
  --maicb-radius: 1.5rem;
  --maicb-shadow: 0 28px 64px -12px rgba(0, 0, 0, 0.55);
  --maicb-launcher-glow: 0 12px 32px -4px rgba(56, 189, 248, 0.42);
}

.maicb-widget.maicb-preset-obsidian,
#multch-plugin-root.maicb-preset-obsidian,
#multch-style-preview.maicb-preset-obsidian {
  --maicb-primary: #34d399;
  --maicb-accent: #2dd4bf;
  --maicb-bg: #0c1117;
  --maicb-fg: #f1f5f9;
  --maicb-muted: #94a3b8;
  --maicb-border: rgba(148, 163, 184, 0.2);
  --maicb-card: rgba(15, 20, 28, 0.97);
  --maicb-header-bg: linear-gradient(135deg, #0f172a 0%, #0c1117 48%, #042f2e 100%);
  --maicb-header-title-color: #f8fafc;
  --maicb-header-sub-color: #cbd5e1;
  --maicb-body-bg: linear-gradient(180deg, #111827 0%, #0c1117 100%);
  --maicb-assistant-bg: rgba(30, 41, 59, 0.82);
  --maicb-composer-bg: rgba(12, 17, 23, 0.98);
  --maicb-radius: 1.35rem;
  --maicb-shadow: 0 28px 64px -12px rgba(0, 0, 0, 0.58);
  --maicb-launcher-glow: 0 12px 32px -4px rgba(52, 211, 153, 0.38);
}

.maicb-widget.maicb-preset-minimal,
#multch-plugin-root.maicb-preset-minimal,
#multch-style-preview.maicb-preset-minimal {
  --maicb-primary: #27272a;
  --maicb-accent: #52525b;
  --maicb-bg: #fafafa;
  --maicb-fg: #18181b;
  --maicb-muted: #71717a;
  --maicb-border: rgba(24, 24, 27, 0.09);
  --maicb-card: #ffffff;
  --maicb-header-bg: #fafafa;
  --maicb-body-bg: #fafafa;
  --maicb-assistant-bg: #ffffff;
  --maicb-composer-bg: #ffffff;
  --maicb-radius: 0.625rem;
  --maicb-shadow: 0 6px 24px -6px rgba(0, 0, 0, 0.14);
  --maicb-launcher-glow: 0 6px 18px -4px rgba(0, 0, 0, 0.25);
  --maicb-scrollbar-radius: 0.25rem;
  --maicb-scrollbar-thumb: color-mix(in srgb, var(--maicb-primary) 55%, var(--maicb-muted) 45%);
}

.maicb-widget.maicb-preset-ocean,
#multch-plugin-root.maicb-preset-ocean,
#multch-style-preview.maicb-preset-ocean {
  --maicb-primary: #0e7490;
  --maicb-accent: #22d3ee;
  --maicb-bg: #ecfeff;
  --maicb-fg: #164e63;
  --maicb-muted: #5c8a96;
  --maicb-border: rgba(14, 116, 144, 0.14);
  --maicb-card: #f0fdff;
  --maicb-header-bg: linear-gradient(135deg, rgba(14, 116, 144, 0.14) 0%, rgba(34, 211, 238, 0.1) 100%);
  --maicb-body-bg: linear-gradient(180deg, #e0f2fe 0%, #ecfeff 55%, #f0fdff 100%);
  --maicb-assistant-bg: rgba(255, 255, 255, 0.92);
  --maicb-composer-bg: rgba(255, 255, 255, 0.96);
  --maicb-radius: 1.375rem;
  --maicb-shadow: 0 22px 50px -18px rgba(14, 116, 144, 0.3);
  --maicb-launcher-glow: 0 10px 26px -6px rgba(14, 116, 144, 0.4);
}

.maicb-widget.maicb-preset-sunset,
#multch-plugin-root.maicb-preset-sunset,
#multch-style-preview.maicb-preset-sunset {
  --maicb-primary: #ea580c;
  --maicb-accent: #f43f5e;
  --maicb-bg: #fff7ed;
  --maicb-fg: #431407;
  --maicb-muted: #9a3412;
  --maicb-border: rgba(234, 88, 12, 0.16);
  --maicb-card: #ffffff;
  --maicb-header-bg: linear-gradient(135deg, rgba(234, 88, 12, 0.14) 0%, rgba(244, 63, 94, 0.1) 100%);
  --maicb-body-bg: linear-gradient(180deg, #ffedd5 0%, #fff7ed 55%, #fffbeb 100%);
  --maicb-assistant-bg: rgba(255, 255, 255, 0.96);
  --maicb-composer-bg: rgba(255, 255, 255, 0.98);
  --maicb-radius: 1.25rem;
  --maicb-shadow: 0 22px 50px -18px rgba(234, 88, 12, 0.28);
  --maicb-launcher-glow: 0 10px 28px -6px rgba(234, 88, 12, 0.42);
}

.maicb-widget.maicb-preset-forest,
#multch-plugin-root.maicb-preset-forest,
#multch-style-preview.maicb-preset-forest {
  --maicb-primary: #059669;
  --maicb-accent: #34d399;
  --maicb-bg: #ecfdf5;
  --maicb-fg: #064e3b;
  --maicb-muted: #047857;
  --maicb-border: rgba(5, 150, 105, 0.16);
  --maicb-card: #f0fdf4;
  --maicb-header-bg: linear-gradient(135deg, rgba(5, 150, 105, 0.14) 0%, rgba(52, 211, 153, 0.1) 100%);
  --maicb-body-bg: linear-gradient(180deg, #d1fae5 0%, #ecfdf5 55%, #f0fdf4 100%);
  --maicb-assistant-bg: rgba(255, 255, 255, 0.94);
  --maicb-composer-bg: rgba(255, 255, 255, 0.97);
  --maicb-radius: 1.3rem;
  --maicb-shadow: 0 22px 50px -18px rgba(5, 150, 105, 0.26);
  --maicb-launcher-glow: 0 10px 26px -6px rgba(5, 150, 105, 0.38);
}

.maicb-widget.maicb-preset-lavender,
#multch-plugin-root.maicb-preset-lavender,
#multch-style-preview.maicb-preset-lavender {
  --maicb-primary: #7c3aed;
  --maicb-accent: #a855f7;
  --maicb-bg: #faf5ff;
  --maicb-fg: #3b0764;
  --maicb-muted: #7e22ce;
  --maicb-border: rgba(124, 58, 237, 0.16);
  --maicb-card: #ffffff;
  --maicb-header-bg: linear-gradient(135deg, rgba(124, 58, 237, 0.12) 0%, rgba(168, 85, 247, 0.09) 100%);
  --maicb-body-bg: linear-gradient(180deg, #ede9fe 0%, #faf5ff 55%, #f5f3ff 100%);
  --maicb-assistant-bg: rgba(255, 255, 255, 0.96);
  --maicb-composer-bg: rgba(255, 255, 255, 0.98);
  --maicb-radius: 1.3rem;
  --maicb-shadow: 0 22px 50px -18px rgba(124, 58, 237, 0.26);
  --maicb-launcher-glow: 0 10px 28px -6px rgba(124, 58, 237, 0.4);
}

.maicb-widget.maicb-preset-plum,
#multch-plugin-root.maicb-preset-plum,
#multch-style-preview.maicb-preset-plum {
  --maicb-primary: #c084fc;
  --maicb-accent: #e879f9;
  --maicb-bg: #1e1b4b;
  --maicb-fg: #f5f3ff;
  --maicb-muted: #c4b5fd;
  --maicb-border: rgba(167, 139, 250, 0.24);
  --maicb-card: rgba(30, 27, 75, 0.97);
  --maicb-header-bg: linear-gradient(135deg, #3b0764 0%, #1e1b4b 52%, #4a044e 100%);
  --maicb-header-title-color: #f5f3ff;
  --maicb-header-sub-color: #ddd6fe;
  --maicb-body-bg: linear-gradient(180deg, #2e1065 0%, #1e1b4b 100%);
  --maicb-assistant-bg: rgba(49, 46, 129, 0.72);
  --maicb-composer-bg: rgba(30, 27, 75, 0.98);
  --maicb-radius: 1.4rem;
  --maicb-shadow: 0 28px 64px -12px rgba(59, 7, 64, 0.55);
  --maicb-launcher-glow: 0 12px 32px -4px rgba(192, 132, 252, 0.42);
}

/* Launcher */
#multch-plugin-root .maicb-launcher,
#multch-style-preview .maicb-launcher {
  position: fixed;
  z-index: calc(var(--maicb-z-base) + 1);
  bottom: calc(env(safe-area-inset-bottom, 0px) + 1.5rem);
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.45rem 1rem 0.45rem 0.45rem;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  background: linear-gradient(
    145deg,
    var(--maicb-primary) 0%,
    color-mix(in srgb, var(--maicb-primary) 68%, var(--maicb-accent)) 100%
  );
  color: #fff;
  font-weight: 600;
  font-size: 0.875rem;
  letter-spacing: -0.01em;
  cursor: pointer;
  box-shadow:
    0 10px 28px -8px color-mix(in srgb, var(--maicb-primary) 55%, transparent),
    0 4px 12px -4px rgba(15, 23, 42, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#multch-plugin-root .maicb-launcher--icon-only,
#multch-style-preview .maicb-launcher--icon-only {
  padding: 0.45rem;
}

#multch-plugin-root .maicb-launcher-icon-wrap,
#multch-style-preview .maicb-launcher-icon-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 2.625rem;
  height: 2.625rem;
}

#multch-plugin-root .maicb-launcher-pulse,
#multch-style-preview .maicb-launcher-pulse {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.28);
  animation: maicb-launcher-pulse 2.8s ease-out infinite;
  pointer-events: none;
}

@keyframes maicb-launcher-pulse {
  0% {
    transform: scale(1);
    opacity: 0.55;
  }

  70%,
  100% {
    transform: scale(1.55);
    opacity: 0;
  }
}

#multch-plugin-root .maicb-launcher-icon,
#multch-style-preview .maicb-launcher-icon {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.625rem;
  height: 2.625rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.28),
    0 2px 8px rgba(15, 23, 42, 0.12);
}

#multch-plugin-root .maicb-launcher-icon svg,
#multch-style-preview .maicb-launcher-icon svg {
  width: 1.2rem;
  height: 1.2rem;
}

#multch-plugin-root .maicb-launcher-text,
#multch-style-preview .maicb-launcher-text {
  padding-right: 0.2rem;
  white-space: nowrap;
}

#multch-plugin-root .maicb-launcher.maicb-launcher-bottom-right,
#multch-plugin-root .maicb-launcher.maicb-launcher-right,
#multch-style-preview .maicb-launcher.maicb-launcher-bottom-right,
#multch-style-preview .maicb-launcher.maicb-launcher-right {
  right: var(--maicb-offset);
  left: auto;
}

#multch-plugin-root .maicb-launcher.maicb-launcher-bottom-left,
#multch-plugin-root .maicb-launcher.maicb-launcher-left,
#multch-style-preview .maicb-launcher.maicb-launcher-bottom-left,
#multch-style-preview .maicb-launcher.maicb-launcher-left {
  left: var(--maicb-offset);
  right: auto;
}

#multch-plugin-root .maicb-launcher.maicb-launcher-center-right,
#multch-style-preview .maicb-launcher.maicb-launcher-center-right {
  top: 50%;
  bottom: auto;
  right: var(--maicb-offset);
  left: auto;
  transform: translateY(-50%);
}

#multch-plugin-root .maicb-launcher.maicb-launcher-center-left,
#multch-style-preview .maicb-launcher.maicb-launcher-center-left {
  top: 50%;
  bottom: auto;
  left: var(--maicb-offset);
  right: auto;
  transform: translateY(-50%);
}

#multch-plugin-root .maicb-launcher.maicb-launcher-center,
#multch-style-preview .maicb-launcher.maicb-launcher-center {
  left: 50%;
  right: auto;
  transform: translateX(-50%);
}

#multch-plugin-root .maicb-launcher.maicb-launcher-bottom-right:hover,
#multch-plugin-root .maicb-launcher.maicb-launcher-right:hover,
#multch-plugin-root .maicb-launcher.maicb-launcher-bottom-left:hover,
#multch-plugin-root .maicb-launcher.maicb-launcher-left:hover,
#multch-style-preview .maicb-launcher.maicb-launcher-bottom-right:hover,
#multch-style-preview .maicb-launcher.maicb-launcher-right:hover,
#multch-style-preview .maicb-launcher.maicb-launcher-bottom-left:hover,
#multch-style-preview .maicb-launcher.maicb-launcher-left:hover {
  transform: translateY(-3px);
  box-shadow:
    0 16px 36px -10px color-mix(in srgb, var(--maicb-primary) 58%, transparent),
    0 6px 16px -6px rgba(15, 23, 42, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.26);
}

#multch-plugin-root .maicb-launcher.maicb-launcher-bottom-right:active,
#multch-plugin-root .maicb-launcher.maicb-launcher-right:active,
#multch-plugin-root .maicb-launcher.maicb-launcher-bottom-left:active,
#multch-plugin-root .maicb-launcher.maicb-launcher-left:active,
#multch-style-preview .maicb-launcher.maicb-launcher-bottom-right:active,
#multch-style-preview .maicb-launcher.maicb-launcher-right:active,
#multch-style-preview .maicb-launcher.maicb-launcher-bottom-left:active,
#multch-style-preview .maicb-launcher.maicb-launcher-left:active {
  transform: translateY(-1px);
}

#multch-plugin-root .maicb-launcher.maicb-launcher-center-right:hover,
#multch-style-preview .maicb-launcher.maicb-launcher-center-right:hover {
  transform: translateY(calc(-50% - 3px));
}

#multch-plugin-root .maicb-launcher.maicb-launcher-center-left:hover,
#multch-style-preview .maicb-launcher.maicb-launcher-center-left:hover {
  transform: translateY(calc(-50% - 3px));
}

#multch-plugin-root .maicb-launcher.maicb-launcher-center-right:active,
#multch-style-preview .maicb-launcher.maicb-launcher-center-right:active {
  transform: translateY(calc(-50% - 1px));
}

#multch-plugin-root .maicb-launcher.maicb-launcher-center-left:active,
#multch-style-preview .maicb-launcher.maicb-launcher-center-left:active {
  transform: translateY(calc(-50% - 1px));
}

#multch-plugin-root .maicb-launcher.maicb-launcher-center:hover,
#multch-style-preview .maicb-launcher.maicb-launcher-center:hover {
  transform: translateX(-50%) translateY(-3px);
}

#multch-plugin-root .maicb-launcher.maicb-launcher-center:active,
#multch-style-preview .maicb-launcher.maicb-launcher-center:active {
  transform: translateX(-50%) translateY(-1px);
}

#multch-plugin-root .maicb-launcher:focus-visible,
#multch-style-preview .maicb-launcher:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
}

#multch-plugin-root .maicb-launcher[hidden],
#multch-style-preview .maicb-launcher[hidden] {
  display: none !important;
}

#multch-plugin-root .maicb-preset-dark-glass .maicb-launcher,
#multch-style-preview .maicb-preset-dark-glass .maicb-launcher {
  border-color: rgba(255, 255, 255, 0.14);
  box-shadow:
    0 12px 32px -8px rgba(56, 189, 248, 0.45),
    0 4px 14px -4px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

#multch-plugin-root .maicb-preset-obsidian .maicb-launcher,
#multch-style-preview .maicb-preset-obsidian .maicb-launcher {
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow:
    0 12px 32px -8px rgba(52, 211, 153, 0.4),
    0 4px 14px -4px rgba(0, 0, 0, 0.38),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

#multch-plugin-root .maicb-preset-minimal .maicb-launcher,
#multch-style-preview .maicb-preset-minimal .maicb-launcher {
  border-radius: 0.75rem;
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 8px 20px -8px rgba(0, 0, 0, 0.28);
}

#multch-plugin-root .maicb-preset-minimal .maicb-launcher-icon,
#multch-style-preview .maicb-preset-minimal .maicb-launcher-icon {
  border-radius: 0.5rem;
}

#multch-plugin-root .maicb-preset-minimal .maicb-launcher-pulse,
#multch-style-preview .maicb-preset-minimal .maicb-launcher-pulse {
  border-radius: 0.5rem;
}

/* Panel */
#multch-plugin-root .maicb-panel,
#multch-style-preview .maicb-panel {
  position: fixed;
  z-index: calc(var(--maicb-z-base) + 2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  width: var(--maicb-panel-width);
  max-width: calc(100vw - 2rem);
  height: min(620px, calc(100dvh - 3.5rem));
  max-height: calc(100dvh - 1.5rem);
  border: 1px solid var(--maicb-border);
  border-radius: var(--maicb-radius);
  background: var(--maicb-card);
  color: var(--maicb-fg);
  box-shadow: var(--maicb-shadow);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

#multch-plugin-root .maicb-panel[hidden],
#multch-style-preview .maicb-panel[hidden] {
  display: none !important;
}

#multch-plugin-root .maicb-panel.maicb-position-center-right,
#multch-style-preview .maicb-panel.maicb-position-center-right {
  top: 50%;
  right: var(--maicb-offset);
  bottom: auto;
  left: auto;
  transform: translateY(-50%);
}

#multch-plugin-root .maicb-panel.maicb-position-bottom-right,
#multch-style-preview .maicb-panel.maicb-position-bottom-right {
  top: auto;
  right: var(--maicb-offset);
  bottom: calc(env(safe-area-inset-bottom, 0px) + 5rem);
  left: auto;
  transform: none;
  height: min(580px, calc(100dvh - 6rem));
}

#multch-plugin-root .maicb-panel.maicb-position-center-left,
#multch-style-preview .maicb-panel.maicb-position-center-left {
  top: 50%;
  left: var(--maicb-offset);
  right: auto;
  bottom: auto;
  transform: translateY(-50%);
}

#multch-plugin-root .maicb-panel.maicb-position-bottom-left,
#multch-style-preview .maicb-panel.maicb-position-bottom-left {
  top: auto;
  left: var(--maicb-offset);
  right: auto;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 5rem);
  transform: none;
  height: min(580px, calc(100dvh - 6rem));
}

#multch-plugin-root .maicb-panel.maicb-position-bottom-center,
#multch-style-preview .maicb-panel.maicb-position-bottom-center {
  top: auto;
  left: 50%;
  right: auto;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 5rem);
  transform: translateX(-50%);
  height: min(580px, calc(100dvh - 6rem));
}

/* Inline mode */
#multch-plugin-root .maicb-inline-wrap .maicb-panel,
#multch-style-preview .maicb-inline-wrap .maicb-panel {
  position: relative;
  top: auto;
  right: auto;
  bottom: auto;
  left: auto;
  transform: none;
  width: 100%;
  max-width: 100%;
  height: min(520px, 70vh);
  min-height: 320px;
  margin: 0 auto;
}

#multch-plugin-root .maicb-inline-wrap .maicb-messages,
#multch-style-preview .maicb-inline-wrap .maicb-messages {
  min-height: 240px;
  max-height: var(--maicb-panel-max-height, none);
}

#multch-plugin-root .maicb-inline-wrap .maicb-launcher,
#multch-style-preview .maicb-inline-wrap .maicb-launcher {
  display: none !important;
}

#multch-plugin-root .maicb-inline-wrap .maicb-minimize,
#multch-style-preview .maicb-inline-wrap .maicb-minimize,
#multch-plugin-root .maicb-inline-wrap .maicb-close,
#multch-style-preview .maicb-inline-wrap .maicb-close {
  display: none !important;
}

/* Header */
#multch-plugin-root .maicb-header,
#multch-style-preview .maicb-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--maicb-border);
  background: var(--maicb-header-bg, color-mix(in srgb, var(--maicb-card) 85%, var(--maicb-primary) 5%));
}

#multch-plugin-root .maicb-header-brand,
#multch-style-preview .maicb-header-brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-width: 0;
  flex: 1;
}

#multch-plugin-root .maicb-header-avatar,
#multch-style-preview .maicb-header-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 2.375rem;
  height: 2.375rem;
  border-radius: 0.7rem;
  background: linear-gradient(
    145deg,
    var(--maicb-primary),
    color-mix(in srgb, var(--maicb-primary) 68%, var(--maicb-accent))
  );
  color: #fff;
  box-shadow: 0 2px 10px color-mix(in srgb, var(--maicb-primary) 32%, transparent);
}

#multch-plugin-root .maicb-header-avatar svg,
#multch-style-preview .maicb-header-avatar svg {
  width: 1.125rem;
  height: 1.125rem;
}

#multch-plugin-root .maicb-header-info,
#multch-style-preview .maicb-header-info {
  min-width: 0;
  flex: 1;
}

#multch-plugin-root .maicb-header .maicb-header-title,
#multch-style-preview .maicb-header .maicb-header-title {
  margin: 0;
  padding: 0;
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--maicb-header-title-color, var(--maicb-fg));
  letter-spacing: -0.02em;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#multch-plugin-root .maicb-header .maicb-header-sub,
#multch-style-preview .maicb-header .maicb-header-sub {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0.2rem 0 0;
  padding: 0;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--maicb-header-sub-color, var(--maicb-muted));
  line-height: 1.3;
  max-width: 100%;
}

#multch-plugin-root .maicb-header-sub-text,
#multch-style-preview .maicb-header-sub-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#multch-plugin-root .maicb-header-status,
#multch-style-preview .maicb-header-status {
  flex-shrink: 0;
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: var(--maicb-status-color, #22c55e);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--maicb-status-color, #22c55e) 22%, transparent);
  animation: maicb-status-pulse 2.4s ease-in-out infinite;
}

@keyframes maicb-status-pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }

  50% {
    opacity: 0.72;
    transform: scale(0.92);
  }
}

#multch-plugin-root .maicb-header-actions,
#multch-style-preview .maicb-header-actions {
  display: flex;
  gap: 0.3rem;
  flex-shrink: 0;
}

#multch-plugin-root .maicb-icon-btn,
#multch-style-preview .maicb-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.125rem;
  height: 2.125rem;
  padding: 0;
  border: 1px solid color-mix(in srgb, var(--maicb-border) 80%, transparent);
  border-radius: 0.625rem;
  background: color-mix(in srgb, var(--maicb-card) 88%, var(--maicb-primary) 4%);
  color: var(--maicb-muted);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

#multch-plugin-root .maicb-icon-btn svg,
#multch-style-preview .maicb-icon-btn svg {
  width: 1rem;
  height: 1rem;
}

#multch-plugin-root .maicb-icon-btn:hover,
#multch-style-preview .maicb-icon-btn:hover {
  background: color-mix(in srgb, var(--maicb-primary) 14%, transparent);
  border-color: color-mix(in srgb, var(--maicb-primary) 28%, transparent);
  color: var(--maicb-primary);
}

#multch-plugin-root .maicb-icon-btn:focus-visible,
#multch-style-preview .maicb-icon-btn:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--maicb-primary) 45%, transparent);
  outline-offset: 1px;
}

/* Preset tweaks */
#multch-plugin-root .maicb-preset-minimal .maicb-header-avatar,
#multch-style-preview .maicb-preset-minimal .maicb-header-avatar {
  border-radius: 0.45rem;
  box-shadow: none;
}

#multch-plugin-root .maicb-preset-minimal .maicb-icon-btn,
#multch-style-preview .maicb-preset-minimal .maicb-icon-btn {
  border-radius: 0.45rem;
  background: var(--maicb-bg);
}

#multch-plugin-root .maicb-preset-dark-glass .maicb-header,
#multch-style-preview .maicb-preset-dark-glass .maicb-header {
  padding: 0.9rem 1rem;
  border-bottom-color: rgba(148, 163, 184, 0.22);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

#multch-plugin-root .maicb-preset-dark-glass .maicb-header-avatar,
#multch-style-preview .maicb-preset-dark-glass .maicb-header-avatar {
  box-shadow: 0 2px 14px rgba(56, 189, 248, 0.38);
}

#multch-plugin-root .maicb-preset-dark-glass .maicb-header .maicb-header-title,
#multch-style-preview .maicb-preset-dark-glass .maicb-header .maicb-header-title {
  font-weight: 600;
  color: var(--maicb-header-title-color, #f8fafc);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.28);
}

#multch-plugin-root .maicb-preset-dark-glass .maicb-header .maicb-header-sub,
#multch-style-preview .maicb-preset-dark-glass .maicb-header .maicb-header-sub {
  color: var(--maicb-header-sub-color, #cbd5e1);
}

#multch-plugin-root .maicb-preset-dark-glass .maicb-header-status,
#multch-style-preview .maicb-preset-dark-glass .maicb-header-status {
  background: #34d399;
  box-shadow: 0 0 8px rgba(52, 211, 153, 0.55);
}

#multch-plugin-root .maicb-preset-dark-glass .maicb-icon-btn,
#multch-style-preview .maicb-preset-dark-glass .maicb-icon-btn {
  border-color: rgba(148, 163, 184, 0.18);
  background: rgba(255, 255, 255, 0.06);
  color: #cbd5e1;
}

#multch-plugin-root .maicb-preset-dark-glass .maicb-icon-btn:hover,
#multch-style-preview .maicb-preset-dark-glass .maicb-icon-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(148, 163, 184, 0.32);
  color: #f8fafc;
}

#multch-plugin-root .maicb-preset-ocean .maicb-header-status,
#multch-style-preview .maicb-preset-ocean .maicb-header-status {
  background: #14b8a6;
  box-shadow: 0 0 0 2px color-mix(in srgb, #14b8a6 22%, transparent);
}

#multch-plugin-root .maicb-preset-sunset .maicb-header-status,
#multch-style-preview .maicb-preset-sunset .maicb-header-status {
  background: #f97316;
  box-shadow: 0 0 0 2px color-mix(in srgb, #f97316 22%, transparent);
}

#multch-plugin-root .maicb-preset-forest .maicb-header-status,
#multch-style-preview .maicb-preset-forest .maicb-header-status {
  background: #10b981;
  box-shadow: 0 0 0 2px color-mix(in srgb, #10b981 22%, transparent);
}

#multch-plugin-root .maicb-preset-lavender .maicb-header-status,
#multch-style-preview .maicb-preset-lavender .maicb-header-status {
  background: #8b5cf6;
  box-shadow: 0 0 0 2px color-mix(in srgb, #8b5cf6 22%, transparent);
}

#multch-plugin-root .maicb-preset-obsidian .maicb-header,
#multch-style-preview .maicb-preset-obsidian .maicb-header {
  padding: 0.9rem 1rem;
  border-bottom-color: rgba(148, 163, 184, 0.2);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

#multch-plugin-root .maicb-preset-obsidian .maicb-header-avatar,
#multch-style-preview .maicb-preset-obsidian .maicb-header-avatar {
  box-shadow: 0 2px 14px rgba(52, 211, 153, 0.35);
}

#multch-plugin-root .maicb-preset-obsidian .maicb-header .maicb-header-title,
#multch-style-preview .maicb-preset-obsidian .maicb-header .maicb-header-title {
  font-weight: 600;
  color: var(--maicb-header-title-color, #f8fafc);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

#multch-plugin-root .maicb-preset-obsidian .maicb-header .maicb-header-sub,
#multch-style-preview .maicb-preset-obsidian .maicb-header .maicb-header-sub {
  color: var(--maicb-header-sub-color, #cbd5e1);
}

#multch-plugin-root .maicb-preset-obsidian .maicb-header-status,
#multch-style-preview .maicb-preset-obsidian .maicb-header-status {
  background: #34d399;
  box-shadow: 0 0 8px rgba(52, 211, 153, 0.5);
}

#multch-plugin-root .maicb-preset-obsidian .maicb-icon-btn,
#multch-style-preview .maicb-preset-obsidian .maicb-icon-btn {
  border-color: rgba(148, 163, 184, 0.16);
  background: rgba(255, 255, 255, 0.05);
  color: #cbd5e1;
}

#multch-plugin-root .maicb-preset-obsidian .maicb-icon-btn:hover,
#multch-style-preview .maicb-preset-obsidian .maicb-icon-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(52, 211, 153, 0.28);
  color: #f8fafc;
}

#multch-plugin-root .maicb-preset-plum .maicb-header,
#multch-style-preview .maicb-preset-plum .maicb-header {
  padding: 0.9rem 1rem;
  border-bottom-color: rgba(167, 139, 250, 0.22);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

#multch-plugin-root .maicb-preset-plum .maicb-header-avatar,
#multch-style-preview .maicb-preset-plum .maicb-header-avatar {
  box-shadow: 0 2px 14px rgba(192, 132, 252, 0.38);
}

#multch-plugin-root .maicb-preset-plum .maicb-header .maicb-header-title,
#multch-style-preview .maicb-preset-plum .maicb-header .maicb-header-title {
  font-weight: 600;
  color: var(--maicb-header-title-color, #f5f3ff);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.28);
}

#multch-plugin-root .maicb-preset-plum .maicb-header .maicb-header-sub,
#multch-style-preview .maicb-preset-plum .maicb-header .maicb-header-sub {
  color: var(--maicb-header-sub-color, #ddd6fe);
}

#multch-plugin-root .maicb-preset-plum .maicb-header-status,
#multch-style-preview .maicb-preset-plum .maicb-header-status {
  background: #a78bfa;
  box-shadow: 0 0 8px rgba(167, 139, 250, 0.55);
}

#multch-plugin-root .maicb-preset-plum .maicb-icon-btn,
#multch-style-preview .maicb-preset-plum .maicb-icon-btn {
  border-color: rgba(167, 139, 250, 0.18);
  background: rgba(255, 255, 255, 0.06);
  color: #ddd6fe;
}

#multch-plugin-root .maicb-preset-plum .maicb-icon-btn:hover,
#multch-style-preview .maicb-preset-plum .maicb-icon-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(167, 139, 250, 0.32);
  color: #f5f3ff;
}

#multch-plugin-root .maicb-preset-plum .maicb-launcher,
#multch-style-preview .maicb-preset-plum .maicb-launcher {
  border-color: rgba(255, 255, 255, 0.14);
  box-shadow:
    0 12px 32px -8px rgba(192, 132, 252, 0.45),
    0 4px 14px -4px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

#multch-plugin-root .maicb-preset-plum .maicb-composer,
#multch-style-preview .maicb-preset-plum .maicb-composer {
  border-top-color: rgba(167, 139, 250, 0.2);
  box-shadow: 0 -8px 24px -12px rgba(0, 0, 0, 0.45);
}

#multch-plugin-root .maicb-preset-plum .maicb-composer-inner,
#multch-style-preview .maicb-preset-plum .maicb-composer-inner {
  background: rgba(46, 16, 101, 0.72);
  border-color: rgba(167, 139, 250, 0.22);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

#multch-plugin-root .maicb-preset-plum .maicb-composer-inner:focus-within,
#multch-style-preview .maicb-preset-plum .maicb-composer-inner:focus-within {
  border-color: color-mix(in srgb, var(--maicb-primary) 55%, transparent);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 0 0 3px color-mix(in srgb, var(--maicb-primary) 18%, transparent);
}

#multch-plugin-root .maicb-preset-plum .maicb-error,
#multch-style-preview .maicb-preset-plum .maicb-error {
  color: #fecaca;
  background: rgba(127, 29, 29, 0.35);
  border-color: rgba(248, 113, 113, 0.35);
}

#multch-plugin-root .maicb-preset-plum .maicb-msg-assistant,
#multch-style-preview .maicb-preset-plum .maicb-msg-assistant,
#multch-plugin-root .maicb-preset-plum .maicb-thinking,
#multch-style-preview .maicb-preset-plum .maicb-thinking {
  border-color: rgba(167, 139, 250, 0.22);
}

#multch-plugin-root .maicb-preset-obsidian .maicb-composer,
#multch-style-preview .maicb-preset-obsidian .maicb-composer {
  border-top-color: rgba(148, 163, 184, 0.18);
  box-shadow: 0 -8px 24px -12px rgba(0, 0, 0, 0.48);
}

#multch-plugin-root .maicb-preset-obsidian .maicb-composer-inner,
#multch-style-preview .maicb-preset-obsidian .maicb-composer-inner {
  background: rgba(17, 24, 39, 0.78);
  border-color: rgba(148, 163, 184, 0.2);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

#multch-plugin-root .maicb-preset-obsidian .maicb-composer-inner:focus-within,
#multch-style-preview .maicb-preset-obsidian .maicb-composer-inner:focus-within {
  border-color: color-mix(in srgb, var(--maicb-primary) 55%, transparent);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 0 0 3px color-mix(in srgb, var(--maicb-primary) 16%, transparent);
}

#multch-plugin-root .maicb-preset-obsidian .maicb-error,
#multch-style-preview .maicb-preset-obsidian .maicb-error {
  color: #fecaca;
  background: rgba(127, 29, 29, 0.32);
  border-color: rgba(248, 113, 113, 0.32);
}

#multch-plugin-root .maicb-preset-obsidian .maicb-msg-assistant,
#multch-style-preview .maicb-preset-obsidian .maicb-msg-assistant,
#multch-plugin-root .maicb-preset-obsidian .maicb-thinking,
#multch-style-preview .maicb-preset-obsidian .maicb-thinking {
  border-color: rgba(148, 163, 184, 0.2);
}

/* Messages */
#multch-plugin-root .maicb-messages,
#multch-style-preview .maicb-messages {
  max-height: var(--maicb-panel-max-height, none);
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 1rem 0.875rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
  background: var(--maicb-body-bg, var(--maicb-bg));
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: var(--maicb-scrollbar-thumb) var(--maicb-scrollbar-track);
}

#multch-plugin-root .maicb-messages::-webkit-scrollbar,
#multch-style-preview .maicb-messages::-webkit-scrollbar {
  width: var(--maicb-scrollbar-size);
}

#multch-plugin-root .maicb-messages::-webkit-scrollbar-track,
#multch-style-preview .maicb-messages::-webkit-scrollbar-track {
  background: var(--maicb-scrollbar-track);
}

#multch-plugin-root .maicb-messages::-webkit-scrollbar-thumb,
#multch-style-preview .maicb-messages::-webkit-scrollbar-thumb {
  border-radius: var(--maicb-scrollbar-radius);
  background: var(--maicb-scrollbar-thumb);
}

#multch-plugin-root .maicb-messages::-webkit-scrollbar-thumb:hover,
#multch-style-preview .maicb-messages::-webkit-scrollbar-thumb:hover {
  background: var(--maicb-scrollbar-thumb-hover);
}

#multch-plugin-root .maicb-messages::-webkit-scrollbar-button,
#multch-plugin-root .maicb-messages::-webkit-scrollbar-button:single-button,
#multch-style-preview .maicb-messages::-webkit-scrollbar-button,
#multch-style-preview .maicb-messages::-webkit-scrollbar-button:single-button {
  display: none;
  width: 0;
  height: 0;
}

#multch-plugin-root .maicb-msg-row,
#multch-style-preview .maicb-msg-row {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  max-width: 100%;
}

#multch-plugin-root .maicb-msg-row-user,
#multch-style-preview .maicb-msg-row-user {
  justify-content: flex-end;
}

#multch-plugin-root .maicb-msg-row-assistant,
#multch-style-preview .maicb-msg-row-assistant {
  justify-content: flex-start;
}

#multch-plugin-root .maicb-msg-avatar,
#multch-style-preview .maicb-msg-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 1.75rem;
  height: 1.75rem;
  margin-bottom: 0.15rem;
  border-radius: 0.5rem;
  background: linear-gradient(
    145deg,
    var(--maicb-primary),
    color-mix(in srgb, var(--maicb-primary) 68%, var(--maicb-accent))
  );
  color: #fff;
  box-shadow: 0 1px 6px color-mix(in srgb, var(--maicb-primary) 28%, transparent);
}

#multch-plugin-root .maicb-msg-avatar svg,
#multch-style-preview .maicb-msg-avatar svg {
  width: 0.95rem;
  height: 0.95rem;
}

#multch-plugin-root .maicb-msg,
#multch-style-preview .maicb-msg {
  max-width: min(88%, 18rem);
  padding: 0.7rem 0.9rem;
  border-radius: 1.125rem;
  font-size: 0.875rem;
  line-height: 1.55;
  word-break: break-word;
  white-space: pre-wrap;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}

#multch-plugin-root .maicb-msg-user,
#multch-style-preview .maicb-msg-user {
  background: linear-gradient(
    135deg,
    var(--maicb-primary),
    color-mix(in srgb, var(--maicb-primary) 72%, var(--maicb-accent))
  );
  color: #fff;
  border-bottom-right-radius: 0.35rem;
  box-shadow: 0 2px 10px color-mix(in srgb, var(--maicb-primary) 28%, transparent);
}

#multch-plugin-root .maicb-msg-assistant,
#multch-style-preview .maicb-msg-assistant {
  background: var(--maicb-assistant-bg, color-mix(in srgb, var(--maicb-fg) 6%, var(--maicb-card)));
  color: var(--maicb-fg);
  border: 1px solid var(--maicb-border);
  border-bottom-left-radius: 0.35rem;
}

#multch-plugin-root .maicb-msg-rich,
#multch-style-preview .maicb-msg-rich {
  white-space: normal;
}

#multch-plugin-root .maicb-msg-body,
#multch-style-preview .maicb-msg-body {
  overflow-wrap: anywhere;
}

#multch-plugin-root .maicb-msg-body > :first-child,
#multch-style-preview .maicb-msg-body > :first-child {
  margin-top: 0;
}

#multch-plugin-root .maicb-msg-body > :last-child,
#multch-style-preview .maicb-msg-body > :last-child {
  margin-bottom: 0;
}

#multch-plugin-root .maicb-msg-body p,
#multch-style-preview .maicb-msg-body p {
  margin: 0 0 0.55em;
}

#multch-plugin-root .maicb-msg-body h1,
#multch-plugin-root .maicb-msg-body h2,
#multch-plugin-root .maicb-msg-body h3,
#multch-style-preview .maicb-msg-body h1,
#multch-style-preview .maicb-msg-body h2,
#multch-style-preview .maicb-msg-body h3 {
  margin: 0 0 0.45em;
  font-size: inherit;
  font-weight: 700;
  line-height: 1.35;
}

#multch-plugin-root .maicb-msg-body ul,
#multch-plugin-root .maicb-msg-body ol,
#multch-style-preview .maicb-msg-body ul,
#multch-style-preview .maicb-msg-body ol {
  margin: 0.35em 0 0.6em;
  padding-left: 1.2rem;
}

#multch-plugin-root .maicb-msg-body li,
#multch-style-preview .maicb-msg-body li {
  margin: 0.2em 0;
}

#multch-plugin-root .maicb-msg-body li::marker,
#multch-style-preview .maicb-msg-body li::marker {
  color: color-mix(in srgb, var(--maicb-fg) 55%, var(--maicb-muted));
}

#multch-plugin-root .maicb-msg-body strong,
#multch-style-preview .maicb-msg-body strong {
  font-weight: 650;
}

#multch-plugin-root .maicb-msg-body em,
#multch-style-preview .maicb-msg-body em {
  font-style: italic;
}

#multch-plugin-root .maicb-msg-body code,
#multch-style-preview .maicb-msg-body code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
    "Courier New", monospace;
  font-size: 0.84em;
  padding: 0.1em 0.35em;
  border-radius: 0.35rem;
  background: color-mix(in srgb, var(--maicb-fg) 8%, transparent);
}

#multch-plugin-root .maicb-msg-body pre,
#multch-style-preview .maicb-msg-body pre {
  margin: 0.45em 0 0.6em;
  padding: 0.55rem 0.65rem;
  overflow-x: auto;
  border-radius: 0.5rem;
  background: color-mix(in srgb, var(--maicb-fg) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--maicb-border) 85%, transparent);
}

#multch-plugin-root .maicb-msg-body pre code,
#multch-style-preview .maicb-msg-body pre code {
  padding: 0;
  background: transparent;
  font-size: 0.8em;
  white-space: pre;
}

#multch-plugin-root .maicb-msg-body a,
#multch-style-preview .maicb-msg-body a {
  color: var(--maicb-primary);
  text-decoration: underline;
  text-underline-offset: 0.12em;
}

#multch-plugin-root .maicb-msg-body a:hover,
#multch-style-preview .maicb-msg-body a:hover {
  opacity: 0.88;
}

#multch-plugin-root .maicb-msg-system,
#multch-style-preview .maicb-msg-system {
  align-self: center;
  max-width: 100%;
  font-size: 0.75rem;
  color: var(--maicb-muted);
  background: color-mix(in srgb, var(--maicb-muted) 8%, transparent);
  border: 1px dashed color-mix(in srgb, var(--maicb-border) 80%, transparent);
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  box-shadow: none;
}

#multch-plugin-root .maicb-msg-meta,
#multch-style-preview .maicb-msg-meta {
  display: block;
  margin-top: 0.4rem;
  padding-top: 0.35rem;
  border-top: 1px solid color-mix(in srgb, var(--maicb-border) 70%, transparent);
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  opacity: 0.7;
}

#multch-plugin-root .maicb-msg-user .maicb-msg-meta,
#multch-style-preview .maicb-msg-user .maicb-msg-meta {
  border-top-color: rgba(255, 255, 255, 0.22);
}

#multch-plugin-root .maicb-msg-pending,
#multch-style-preview .maicb-msg-pending {
  display: flex;
  align-items: center;
  min-width: 0;
  padding: 0.5rem 0.8rem;
}

#multch-plugin-root .maicb-msg-pending.maicb-msg-assistant,
#multch-style-preview .maicb-msg-pending.maicb-msg-assistant {
  position: relative;
  overflow: hidden;
}

#multch-plugin-root .maicb-msg-pending.maicb-msg-assistant::after,
#multch-style-preview .maicb-msg-pending.maicb-msg-assistant::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(
    105deg,
    transparent 38%,
    color-mix(in srgb, var(--maicb-primary) 6%, transparent) 50%,
    transparent 62%
  );
  background-size: 220% 100%;
  animation: maicb-pending-shimmer 2.4s ease-in-out infinite;
  pointer-events: none;
}

@keyframes maicb-pending-shimmer {
  0% {
    background-position: 120% 0;
  }

  100% {
    background-position: -120% 0;
  }
}

#multch-plugin-root .maicb-thinking,
#multch-style-preview .maicb-thinking {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 1.25rem;
}

#multch-plugin-root .maicb-thinking-dots,
#multch-style-preview .maicb-thinking-dots {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  height: 1.1rem;
  color: color-mix(in srgb, var(--maicb-fg) 52%, var(--maicb-muted));
}

.maicb-widget .maicb-thinking-dot,
#multch-plugin-root .maicb-thinking-dot,
#multch-style-preview .maicb-thinking-dot {
  display: block;
  flex-shrink: 0;
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 50%;
  background: currentColor;
  animation: maicb-typing-pulse 1.35s ease-in-out infinite;
  will-change: transform, opacity;
}

.maicb-widget .maicb-thinking-dot:nth-child(1),
#multch-plugin-root .maicb-thinking-dot:nth-child(1),
#multch-style-preview .maicb-thinking-dot:nth-child(1) {
  animation-delay: 0s;
}

.maicb-widget .maicb-thinking-dot:nth-child(2),
#multch-plugin-root .maicb-thinking-dot:nth-child(2),
#multch-style-preview .maicb-thinking-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.maicb-widget .maicb-thinking-dot:nth-child(3),
#multch-plugin-root .maicb-thinking-dot:nth-child(3),
#multch-style-preview .maicb-thinking-dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes maicb-typing-pulse {
  0%,
  70%,
  100% {
    opacity: 0.28;
    transform: scale(0.82);
  }

  35% {
    opacity: 1;
    transform: scale(1);
  }
}

/* Composer */
#multch-plugin-root .maicb-composer,
#multch-style-preview .maicb-composer {
  flex-shrink: 0;
  margin: 0;
  padding: 0.65rem 0.875rem calc(0.75rem + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--maicb-border);
  background: var(--maicb-composer-bg, var(--maicb-card));
  box-shadow: 0 -6px 20px -10px rgba(15, 23, 42, 0.12);
}

#multch-plugin-root .maicb-composer-inner,
#multch-style-preview .maicb-composer-inner {
  display: flex;
  align-items: flex-end;
  gap: 0.45rem;
  padding: 0.35rem 0.4rem 0.35rem 0.875rem;
  border: 1px solid var(--maicb-border);
  border-radius: 1.25rem;
  background: var(--maicb-bg);
  box-shadow:
    inset 0 1px 2px rgba(15, 23, 42, 0.04),
    0 1px 2px rgba(15, 23, 42, 0.03);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

#multch-plugin-root .maicb-composer-inner:focus-within,
#multch-style-preview .maicb-composer-inner:focus-within {
  border-color: color-mix(in srgb, var(--maicb-primary) 42%, transparent);
  box-shadow:
    inset 0 1px 2px rgba(15, 23, 42, 0.04),
    0 0 0 3px color-mix(in srgb, var(--maicb-primary) 12%, transparent);
}

#multch-plugin-root .maicb-composer:has(.maicb-credit),
#multch-style-preview .maicb-composer:has(.maicb-credit) {
  padding-bottom: 0.4rem;
}

#multch-plugin-root .maicb-credit,
#multch-style-preview .maicb-credit {
  margin: 0.28rem 0 0;
  padding: 0;
  font-size: 0.625rem;
  line-height: 1.35;
  text-align: center;
  color: color-mix(in srgb, var(--maicb-fg, #64748b) 38%, transparent);
  letter-spacing: 0.01em;
  user-select: none;
}

#multch-plugin-root .maicb-credit a,
#multch-style-preview .maicb-credit a {
  color: inherit;
  text-decoration: none;
}

#multch-plugin-root .maicb-credit a:hover,
#multch-style-preview .maicb-credit a:hover,
#multch-plugin-root .maicb-credit a:focus-visible,
#multch-style-preview .maicb-credit a:focus-visible {
  text-decoration: underline;
  color: color-mix(in srgb, var(--maicb-fg, #64748b) 52%, transparent);
}

#multch-plugin-root .maicb-input,
#multch-style-preview .maicb-input {
  flex: 1;
  min-height: 2.25rem;
  max-height: 6rem;
  padding: 0.5rem 0;
  padding-right: 0.15rem;
  border: none;
  border-radius: 0;
  background: transparent;
  color: var(--maicb-fg);
  resize: none;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--maicb-scrollbar-thumb) var(--maicb-scrollbar-track);
  font: inherit;
  line-height: 1.45;
}

#multch-plugin-root .maicb-input::-webkit-scrollbar,
#multch-style-preview .maicb-input::-webkit-scrollbar {
  width: var(--maicb-scrollbar-size-input);
}

#multch-plugin-root .maicb-input::-webkit-scrollbar-track,
#multch-style-preview .maicb-input::-webkit-scrollbar-track {
  background: var(--maicb-scrollbar-track);
  margin: 0.2rem 0;
}

#multch-plugin-root .maicb-input::-webkit-scrollbar-thumb,
#multch-style-preview .maicb-input::-webkit-scrollbar-thumb {
  border-radius: var(--maicb-scrollbar-radius);
  background: var(--maicb-scrollbar-thumb);
}

#multch-plugin-root .maicb-input::-webkit-scrollbar-thumb:hover,
#multch-style-preview .maicb-input::-webkit-scrollbar-thumb:hover {
  background: var(--maicb-scrollbar-thumb-hover);
}

#multch-plugin-root .maicb-input::-webkit-scrollbar-button,
#multch-plugin-root .maicb-input::-webkit-scrollbar-button:single-button,
#multch-style-preview .maicb-input::-webkit-scrollbar-button,
#multch-style-preview .maicb-input::-webkit-scrollbar-button:single-button {
  display: none;
  width: 0;
  height: 0;
}

#multch-plugin-root .maicb-input::placeholder,
#multch-style-preview .maicb-input::placeholder {
  color: color-mix(in srgb, var(--maicb-muted) 82%, transparent);
}

#multch-plugin-root .maicb-input:focus,
#multch-style-preview .maicb-input:focus {
  outline: none;
}

#multch-plugin-root .maicb-send,
#multch-style-preview .maicb-send {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 2.375rem;
  height: 2.375rem;
  margin-bottom: 0.05rem;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: linear-gradient(
    135deg,
    var(--maicb-primary),
    color-mix(in srgb, var(--maicb-primary) 72%, var(--maicb-accent))
  );
  color: #fff;
  cursor: pointer;
  box-shadow: 0 2px 10px color-mix(in srgb, var(--maicb-primary) 28%, transparent);
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

#multch-plugin-root .maicb-send svg,
#multch-style-preview .maicb-send svg {
  width: 1rem;
  height: 1rem;
  margin-left: 0.05rem;
}

#multch-plugin-root .maicb-send:hover:not(:disabled),
#multch-style-preview .maicb-send:hover:not(:disabled) {
  transform: translateY(-1px) scale(1.02);
  box-shadow: 0 4px 14px color-mix(in srgb, var(--maicb-primary) 34%, transparent);
}

#multch-plugin-root .maicb-send:active:not(:disabled),
#multch-style-preview .maicb-send:active:not(:disabled) {
  transform: translateY(0) scale(0.98);
}

#multch-plugin-root .maicb-send:disabled,
#multch-style-preview .maicb-send:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

#multch-plugin-root .maicb-preset-dark-glass .maicb-composer,
#multch-style-preview .maicb-preset-dark-glass .maicb-composer {
  border-top-color: rgba(148, 163, 184, 0.2);
  box-shadow: 0 -8px 24px -12px rgba(0, 0, 0, 0.45);
}

#multch-plugin-root .maicb-preset-dark-glass .maicb-composer-inner,
#multch-style-preview .maicb-preset-dark-glass .maicb-composer-inner {
  background: rgba(30, 41, 59, 0.72);
  border-color: rgba(148, 163, 184, 0.22);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

#multch-plugin-root .maicb-preset-dark-glass .maicb-composer-inner:focus-within,
#multch-style-preview .maicb-preset-dark-glass .maicb-composer-inner:focus-within {
  border-color: color-mix(in srgb, var(--maicb-primary) 55%, transparent);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 0 0 3px color-mix(in srgb, var(--maicb-primary) 18%, transparent);
}

#multch-plugin-root .maicb-preset-minimal .maicb-composer-inner,
#multch-style-preview .maicb-preset-minimal .maicb-composer-inner {
  border-radius: 0.625rem;
}

#multch-plugin-root .maicb-preset-minimal .maicb-send,
#multch-style-preview .maicb-preset-minimal .maicb-send {
  border-radius: 0.5rem;
}

#multch-plugin-root .maicb-error,
#multch-style-preview .maicb-error {
  flex-shrink: 0;
  margin: 0 0.875rem 0.5rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.75rem;
  line-height: 1.4;
  color: #b91c1c;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 0.625rem;
}

#multch-plugin-root .maicb-preset-dark-glass .maicb-error,
#multch-style-preview .maicb-preset-dark-glass .maicb-error {
  color: #fecaca;
  background: rgba(127, 29, 29, 0.35);
  border-color: rgba(248, 113, 113, 0.35);
}

#multch-plugin-root .maicb-preset-dark-glass .maicb-msg-assistant,
#multch-style-preview .maicb-preset-dark-glass .maicb-msg-assistant,
#multch-plugin-root .maicb-preset-dark-glass .maicb-thinking,
#multch-style-preview .maicb-preset-dark-glass .maicb-thinking {
  border-color: rgba(148, 163, 184, 0.22);
}

#multch-plugin-root .maicb-preset-minimal .maicb-msg,
#multch-style-preview .maicb-preset-minimal .maicb-msg,
#multch-plugin-root .maicb-preset-minimal .maicb-msg-avatar,
#multch-style-preview .maicb-preset-minimal .maicb-msg-avatar {
  border-radius: 0.5rem;
}

/* Tablet (641px–1024px): panel flotante, sin pantalla completa */
@media (min-width: 641px) and (max-width: 1024px) {
  .maicb-widget,
  #multch-plugin-root {
    --maicb-panel-width: min(360px, calc(100vw - 2rem));
  }

#multch-plugin-root .maicb-panel,
#multch-style-preview .maicb-panel {
    height: min(540px, calc(100dvh - 5.5rem));
    max-height: calc(100dvh - 1.25rem);
  }

  .maicb-panel.maicb-position-bottom-right,
  .maicb-panel.maicb-position-bottom-left,
#multch-plugin-root .maicb-panel.maicb-position-bottom-center,
#multch-style-preview .maicb-panel.maicb-position-bottom-center {
    height: min(520px, calc(100dvh - 6.5rem));
  }

  #multch-plugin-root .maicb-panel.maicb-position-center-right,
  #multch-style-preview .maicb-panel.maicb-position-center-right,
  #multch-plugin-root .maicb-panel.maicb-position-center-left,
  #multch-style-preview .maicb-panel.maicb-position-center-left {
    top: 50%;
    bottom: auto;
    transform: translateY(-50%);
    width: min(var(--maicb-panel-width), calc(100vw - 1.5rem));
    height: min(72dvh, 560px);
  }

  #multch-plugin-root .maicb-panel.maicb-position-center-left,
  #multch-style-preview .maicb-panel.maicb-position-center-left {
    left: var(--maicb-offset);
    right: auto;
  }

  #multch-plugin-root .maicb-panel.maicb-position-center-right,
  #multch-style-preview .maicb-panel.maicb-position-center-right {
    right: var(--maicb-offset);
    left: auto;
  }

  #multch-plugin-root .maicb-launcher.maicb-launcher-center-right,
  #multch-style-preview .maicb-launcher.maicb-launcher-center-right,
  #multch-plugin-root .maicb-launcher.maicb-launcher-center-left,
  #multch-style-preview .maicb-launcher.maicb-launcher-center-left {
    top: 50%;
    bottom: auto;
    transform: translateY(-50%);
  }

#multch-plugin-root .maicb-panel.maicb-position-bottom-center,
#multch-style-preview .maicb-panel.maicb-position-bottom-center {
    width: min(var(--maicb-panel-width), calc(100vw - 1.5rem));
    left: 50%;
    transform: translateX(-50%);
  }
}

/* Mobile (≤640px): panel a pantalla completa al abrir */
@media (max-width: 640px) {
  .maicb-widget,
  #multch-plugin-root {
    --maicb-panel-width: calc(100vw - 1.5rem);
    --maicb-offset: max(0.75rem, env(safe-area-inset-left, 0px));
  }

#multch-plugin-root .maicb-launcher.maicb-launcher-bottom-right,
  #multch-plugin-root .maicb-launcher.maicb-launcher-right,
  #multch-plugin-root .maicb-launcher.maicb-launcher-bottom-left,
  #multch-plugin-root .maicb-launcher.maicb-launcher-left,
  #multch-plugin-root .maicb-launcher.maicb-launcher-center,
  #multch-style-preview .maicb-launcher.maicb-launcher-bottom-right,
  #multch-style-preview .maicb-launcher.maicb-launcher-right,
  #multch-style-preview .maicb-launcher.maicb-launcher-bottom-left,
  #multch-style-preview .maicb-launcher.maicb-launcher-left,
  #multch-style-preview .maicb-launcher.maicb-launcher-center {
    bottom: calc(env(safe-area-inset-bottom, 0px) + 1rem);
    max-width: calc(100vw - 1.5rem);
  }

  #multch-plugin-root .maicb-launcher.maicb-launcher-center-right,
  #multch-plugin-root .maicb-launcher.maicb-launcher-center-left,
  #multch-style-preview .maicb-launcher.maicb-launcher-center-right,
  #multch-style-preview .maicb-launcher.maicb-launcher-center-left {
    top: 50%;
    bottom: auto;
    transform: translateY(-50%);
  }

#multch-plugin-root .maicb-launcher.maicb-launcher-center,
#multch-style-preview .maicb-launcher.maicb-launcher-center {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
  }

#multch-plugin-root .maicb-launcher.maicb-launcher-center:hover,
#multch-style-preview .maicb-launcher.maicb-launcher-center:hover {
    transform: translateX(-50%) translateY(-3px);
  }

#multch-plugin-root .maicb-launcher.maicb-launcher-center:active,
#multch-style-preview .maicb-launcher.maicb-launcher-center:active {
    transform: translateX(-50%) translateY(-1px);
  }

#multch-plugin-root .maicb-launcher-text,
#multch-style-preview .maicb-launcher-text {
    max-width: 9rem;
    overflow: hidden;
    text-overflow: ellipsis;
  }

#multch-plugin-root .maicb-msg,
#multch-style-preview .maicb-msg {
    max-width: min(92%, 20rem);
  }

  #multch-plugin-root[data-mode="floating"] .maicb-panel:not([hidden]) {
    top: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    margin: 0;
    border-radius: 0;
    transform: none !important;
  }
}

/* Teléfono estrecho */
@media (max-width: 480px) {
#multch-plugin-root .maicb-launcher:not(.maicb-launcher--icon-only) .maicb-launcher-text,
#multch-style-preview .maicb-launcher:not(.maicb-launcher--icon-only) .maicb-launcher-text {
    display: none;
  }

#multch-plugin-root .maicb-launcher:not(.maicb-launcher--icon-only),
#multch-style-preview .maicb-launcher:not(.maicb-launcher--icon-only) {
    padding: 0.45rem;
  }
}

/* Reduce motion */
#multch-plugin-root .maicb-reduce-motion .maicb-launcher-pulse,
#multch-style-preview .maicb-reduce-motion .maicb-launcher-pulse {
  animation: none !important;
  opacity: 0;
}

#multch-plugin-root .maicb-reduce-motion .maicb-msg-pending.maicb-msg-assistant::after,
#multch-style-preview .maicb-reduce-motion .maicb-msg-pending.maicb-msg-assistant::after,
.maicb-widget.maicb-reduce-motion .maicb-msg-pending.maicb-msg-assistant::after {
  animation: none;
  opacity: 0;
}

.maicb-widget.maicb-reduce-motion .maicb-thinking-dot,
#multch-plugin-root .maicb-reduce-motion .maicb-thinking-dot,
#multch-style-preview .maicb-reduce-motion .maicb-thinking-dot {
  animation: maicb-typing-fade 1.5s ease-in-out infinite;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  #multch-plugin-root .maicb-launcher-pulse,
  #multch-style-preview .maicb-launcher-pulse {
    animation: none !important;
    opacity: 0;
  }

  #multch-plugin-root .maicb-msg-pending.maicb-msg-assistant::after,
  #multch-style-preview .maicb-msg-pending.maicb-msg-assistant::after,
  .maicb-widget .maicb-msg-pending.maicb-msg-assistant::after {
    animation: none;
    opacity: 0;
  }

  .maicb-widget .maicb-thinking-dot,
  #multch-plugin-root .maicb-thinking-dot,
  #multch-style-preview .maicb-thinking-dot {
    animation: maicb-typing-fade 1.5s ease-in-out infinite;
    transform: none;
  }
}

@keyframes maicb-typing-fade {
  0%,
  100% {
    opacity: 0.3;
  }

  50% {
    opacity: 1;
  }
}
