/* SUPPIX AI Operator — floating button + chat drawer (additive, non-breaking) */

.aio-root {
  --aio-bg: #0b1220;
  --aio-panel: #121a2b;
  --aio-border: rgba(148, 163, 184, 0.22);
  --aio-text: #e8eef4;
  --aio-muted: #94a3b8;
  --aio-accent: #38bdf8;
  --aio-accent-2: #5eead4;
  --aio-danger: #f87171;
  --aio-ok: #34d399;
  --aio-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
  position: fixed;
  z-index: 2147483000;
  inset: auto 1.1rem 1.1rem auto;
  font-family: "Segoe UI Variable", "Segoe UI", ui-sans-serif, system-ui, sans-serif;
  color: var(--aio-text);
  pointer-events: none;
}

html[dir="rtl"] .aio-root,
body[dir="rtl"] .aio-root,
.aio-root[data-rtl="1"] {
  inset: auto auto 1.1rem 1.1rem;
}

.aio-root * {
  box-sizing: border-box;
}

.aio-fab {
  pointer-events: auto;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 1px solid rgba(56, 189, 248, 0.35);
  background:
    radial-gradient(circle at 30% 25%, rgba(94, 234, 212, 0.35), transparent 55%),
    linear-gradient(145deg, #0f2744, #0b1628 60%, #10243a);
  color: var(--aio-accent-2);
  box-shadow: var(--aio-shadow), 0 0 0 1px rgba(255, 255, 255, 0.04) inset;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
  padding: 0;
}

.aio-fab:hover {
  transform: translateY(-2px) scale(1.03);
  border-color: rgba(94, 234, 212, 0.55);
}

.aio-fab:active {
  transform: translateY(0) scale(0.98);
}

.aio-fab:focus-visible {
  outline: 2px solid var(--aio-accent);
  outline-offset: 3px;
}

.aio-fab[hidden],
.aio-drawer[hidden],
.aio-backdrop[hidden] {
  display: none !important;
}

.aio-fab-icon {
  width: 22px;
  height: 22px;
  display: block;
}

.aio-fab-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1.5px solid #0b1628;
  background: #64748b;
  pointer-events: none;
}

.aio-fab-badge.is-ok {
  background: #34d399;
}

.aio-fab-badge.is-limited {
  background: #fbbf24;
}

.aio-fab {
  position: relative;
}

.aio-icon-btn.voice-reply-on {
  color: var(--aio-accent-2);
}

.aio-icon-btn.speaking {
  color: var(--aio-danger);
}

.aio-fab-pulse {
  position: absolute;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 2px solid rgba(56, 189, 248, 0.45);
  animation: aio-pulse 2.4s ease-out infinite;
  pointer-events: none;
}

.aio-fab.is-ambient {
  border-color: rgba(94, 234, 212, 0.55);
}

.aio-fab.is-listening {
  border-color: rgba(248, 113, 113, 0.75);
  box-shadow: var(--aio-shadow), 0 0 0 3px rgba(248, 113, 113, 0.22);
}

.aio-fab.is-urgent {
  border-color: rgba(251, 191, 36, 0.85);
  box-shadow: var(--aio-shadow), 0 0 0 3px rgba(251, 191, 36, 0.28);
}

.aio-fab.is-urgent .aio-fab-pulse {
  border-color: rgba(251, 191, 36, 0.7);
  animation: aio-pulse 1.4s ease-out infinite;
}

.aio-recent {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  padding: 0 0.85rem 0.35rem;
  pointer-events: auto;
}

.aio-recent-label {
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--aio-muted);
  margin-inline-end: 0.15rem;
}

.aio-chip-recent,
.aio-chip-live {
  border-color: rgba(94, 234, 212, 0.35);
  background: rgba(15, 39, 68, 0.85);
}

.aio-chip-live {
  border-style: dashed;
}

.aio-chip-action {
  border-color: rgba(251, 191, 36, 0.45);
  color: #fde68a;
}

.aio-chip-nav {
  border-color: rgba(56, 189, 248, 0.45);
  color: #bae6fd;
}

.aio-fab.is-listening .aio-fab-pulse {
  border-color: rgba(248, 113, 113, 0.65);
  animation: aio-pulse 1.1s ease-out infinite;
}

@keyframes aio-pulse {
  0% { transform: scale(1); opacity: 0.55; }
  100% { transform: scale(1.55); opacity: 0; }
}

  .aio-backdrop {
  pointer-events: auto;
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.45);
  backdrop-filter: blur(2px);
  z-index: 2147482990;
}

.aio-drawer {
  pointer-events: auto;
  position: fixed;
  z-index: 2147483010;
  right: 1rem;
  bottom: 5.2rem;
  width: min(420px, calc(100vw - 1.5rem));
  height: min(640px, calc(100vh - 6.5rem));
  display: flex;
  flex-direction: column;
  background:
    linear-gradient(180deg, rgba(18, 28, 48, 0.98), rgba(10, 16, 28, 0.99));
  border: 1px solid var(--aio-border);
  border-radius: 18px;
  box-shadow: var(--aio-shadow);
  overflow: hidden;
  transform-origin: bottom right;
  animation: aio-open 0.18s ease-out;
}

html[dir="rtl"] .aio-drawer,
body[dir="rtl"] .aio-drawer,
.aio-root[data-rtl="1"] .aio-drawer {
  right: auto;
  left: 1rem;
  transform-origin: bottom left;
}

@keyframes aio-open {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.aio-head {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.75rem 0.85rem;
  border-bottom: 1px solid var(--aio-border);
  background: rgba(8, 14, 26, 0.65);
  flex-shrink: 0;
}

.aio-head-mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  flex-shrink: 0;
}

.aio-head h2 {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 650;
  letter-spacing: 0.01em;
}

.aio-head p {
  margin: 0.1rem 0 0;
  font-size: 0.72rem;
  color: var(--aio-muted);
}

.aio-head-actions {
  margin-inline-start: auto;
  display: flex;
  gap: 0.35rem;
}

.aio-icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  border: 1px solid var(--aio-border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--aio-muted);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 0.95rem;
  line-height: 1;
}

.aio-icon-btn:hover {
  color: var(--aio-text);
  border-color: rgba(56, 189, 248, 0.35);
}

.aio-chips-toggle {
  align-self: flex-start;
  margin: 0.35rem 0.75rem 0;
  border: 1px solid var(--aio-border);
  background: transparent;
  color: var(--aio-muted);
  border-radius: 999px;
  padding: 0.2rem 0.65rem;
  font-size: 0.7rem;
  cursor: pointer;
}

.aio-chips-toggle:hover {
  color: var(--aio-text);
  border-color: rgba(56, 189, 248, 0.35);
}

.aio-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.55rem 0.75rem 0.15rem;
  flex-shrink: 0;
}

.aio-chips[hidden],
form.aio-form[data-aio="form"][hidden] {
  display: none !important;
}

/* Legacy under-answer composers are removed in JS; hide if any remain. */
.aio-followup {
  display: none !important;
}

.aio-chip {
  border: 1px solid var(--aio-border);
  background: rgba(56, 189, 248, 0.08);
  color: var(--aio-text);
  border-radius: 999px;
  padding: 0.28rem 0.65rem;
  font-size: 0.72rem;
  cursor: pointer;
  line-height: 1.2;
}

.aio-chip:hover {
  border-color: rgba(94, 234, 212, 0.4);
  background: rgba(94, 234, 212, 0.1);
}

.aio-log {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 0.65rem 0.85rem 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  scrollbar-width: thin;
}

.aio-turn {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  max-width: 100%;
}

.aio-msg {
  max-width: 95%;
  padding: 0.55rem 0.7rem;
  border-radius: 12px;
  font-size: 0.86rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.aio-msg-user {
  align-self: flex-end;
  background: rgba(56, 189, 248, 0.16);
  border: 1px solid rgba(56, 189, 248, 0.25);
}

.aio-msg-bot {
  align-self: stretch;
  max-width: 100%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--aio-border);
  white-space: normal;
}

.aio-msg-status-bot {
  max-width: 95%;
  align-self: flex-start;
  padding: 0.4rem 0.65rem;
  opacity: 0.92;
}

.aio-msg-status-bot .aio-msg-bot-label {
  margin-bottom: 0.15rem;
}

.aio-msg-bot-label {
  font-size: 0.68rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #67e8f9;
  margin-bottom: 0.35rem;
}

.aio-msg-body {
  white-space: normal;
  word-break: break-word;
}

.aio-msg-body p {
  margin: 0 0 0.55rem;
}

.aio-msg-body p:last-child {
  margin-bottom: 0;
}

.aio-msg-body ul,
.aio-msg-body ol {
  margin: 0.2rem 0 0.55rem;
  padding-inline-start: 1.1rem;
}

.aio-msg-body li {
  margin: 0.2rem 0;
}

.aio-msg-body strong {
  color: #fff;
  font-weight: 700;
}

.aio-msg-body code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.84em;
  background: rgba(125, 211, 252, 0.1);
  border: 1px solid rgba(125, 211, 252, 0.14);
  padding: 0.1rem 0.35rem;
  border-radius: 6px;
}

.aio-msg-actions {
  display: flex;
  align-items: center;
  gap: 0.1rem;
  margin-top: 0.55rem;
  padding-top: 0.15rem;
  flex-wrap: wrap;
  position: relative;
  opacity: 0.78;
  transition: opacity 0.18s ease;
}

.aio-msg-bot:hover .aio-msg-actions,
.aio-msg-actions:focus-within,
.aio-msg-actions.has-open-menu {
  opacity: 1;
}

.aio-msg-action-btn {
  width: 2.05rem;
  height: 2.05rem;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  background: transparent;
  color: #93a9c2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.12s ease;
}

.aio-msg-action-btn svg {
  width: 1.05rem;
  height: 1.05rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.aio-msg-action-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #f2f7ff;
  border-color: rgba(120, 156, 255, 0.16);
}

.aio-msg-action-btn:active {
  transform: scale(0.96);
}

.aio-msg-action-btn.is-active,
.aio-msg-action-btn.is-speaking {
  color: #7dd3fc;
  background: rgba(56, 189, 248, 0.14);
  border-color: rgba(56, 189, 248, 0.28);
}

.aio-msg-more-menu {
  position: absolute;
  inset-inline-start: 0;
  bottom: calc(100% + 0.4rem);
  min-width: 14rem;
  background: rgba(18, 26, 40, 0.96);
  border: 1px solid rgba(120, 156, 255, 0.18);
  border-radius: 14px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
  padding: 0.45rem;
  z-index: 6;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.aio-msg-more-menu.is-hidden {
  display: none;
}

.aio-msg-more-time {
  font-size: 0.68rem;
  color: #8096b0;
  padding: 0.25rem 0.45rem 0.35rem;
}

.aio-msg-more-menu > button {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  width: 100%;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: #e2e8f0;
  font: inherit;
  font-size: 0.8rem;
  padding: 0.45rem 0.55rem;
  cursor: pointer;
  text-align: start;
}

.aio-msg-more-menu > button:hover {
  background: rgba(255, 255, 255, 0.06);
}

.aio-msg-more-ico {
  display: inline-flex;
  width: 1.1rem;
  height: 1.1rem;
  color: #93a9c2;
}

.aio-msg-more-ico svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.aio-toast {
  position: absolute;
  left: 50%;
  bottom: 5.5rem;
  transform: translateX(-50%) translateY(8px);
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: #e2e8f0;
  font-size: 0.75rem;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 5;
  white-space: nowrap;
}

.aio-toast.is-on {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.aio-msg-meta {
  margin-top: 0.45rem;
  font-size: 0.68rem;
  color: #8096b0;
  padding: 0.4rem 0.55rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(120, 156, 255, 0.08);
  line-height: 1.4;
}

.aio-msg-status {
  align-self: flex-start;
  font-size: 0.75rem;
  color: var(--aio-muted);
  padding: 0.15rem 0.35rem;
}

.aio-card {
  align-self: stretch;
  border: 1px solid rgba(251, 191, 36, 0.35);
  background: rgba(251, 191, 36, 0.08);
  border-radius: 12px;
  padding: 0.65rem 0.75rem;
}

.aio-card h3 {
  margin: 0 0 0.25rem;
  font-size: 0.8rem;
  font-weight: 650;
  color: #fbbf24;
}

.aio-card p {
  margin: 0 0 0.55rem;
  font-size: 0.78rem;
  color: var(--aio-text);
  line-height: 1.4;
}

.aio-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.aio-btn {
  border-radius: 9px;
  border: 1px solid var(--aio-border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--aio-text);
  font-size: 0.75rem;
  padding: 0.35rem 0.65rem;
  cursor: pointer;
}

.aio-btn-primary {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.9), rgba(94, 234, 212, 0.75));
  color: #0b1220;
  border-color: transparent;
  font-weight: 650;
}

.aio-btn-danger {
  border-color: rgba(248, 113, 113, 0.4);
  color: #fecaca;
}

.aio-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.aio-actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.45rem;
}

.aio-verify {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin: 0 0 0.45rem;
  padding: 0.55rem 0.65rem;
  border-radius: 0.75rem;
  border: 1px solid rgba(56, 189, 248, 0.45);
  background: rgba(14, 116, 144, 0.18);
}

.aio-verify[hidden] {
  display: none !important;
}

.aio-verify-label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #7dd3fc;
}

.aio-verify-text {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.4;
  color: #f1f5f9;
  white-space: pre-wrap;
  word-break: break-word;
}

.aio-verify-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.aio-form.aio-verify-pending .bp-ai-composer,
.aio-form.aio-verify-pending .aio-composer-row {
  border-color: rgba(125, 211, 252, 0.75);
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.25);
}

.aio-send-pulse,
.aio-btn.aio-send-pulse {
  animation: aio-send-pulse 1.4s ease-in-out infinite;
}

@keyframes aio-send-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(56, 189, 248, 0.45);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(56, 189, 248, 0);
  }
}

.aio-form,
.aio-followup {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.aio-form {
  flex-shrink: 0;
  padding: 0.55rem 0.75rem 0.35rem;
  border-top: 1px solid var(--aio-border);
  background: linear-gradient(180deg, rgba(8, 14, 26, 0.35), rgba(8, 14, 26, 0.85));
}

.aio-followup {
  padding: 0.1rem 0 0.15rem;
}

.aio-form.bp-ai-form-enhanced,
.aio-followup.bp-ai-form-enhanced {
  padding-top: 0.35rem;
}

.aio-form .bp-ai-composer-wrap,
.aio-followup .bp-ai-composer-wrap {
  padding: 0;
  border-top: none;
  background: transparent;
}

/* Command-Center-style pill composer (main + under each answer) */
.aio-root .bp-ai-composer,
.aio-composer-row {
  --bp-composer-bg: #151e2e;
  --bp-composer-border: rgba(56, 189, 248, 0.42);
  --bp-composer-focus: #38bdf8;
  --bp-composer-text: #f3f4f6;
  --bp-composer-placeholder: #94a3b8;
  --bp-composer-mic: #94a3b8;
  display: flex;
  align-items: flex-end;
  gap: 0.3rem;
  width: 100%;
  padding: 0.4rem 0.45rem 0.4rem 0.9rem;
  border-radius: 1.625rem;
  border: 1px solid var(--bp-composer-border);
  background: var(--bp-composer-bg);
  box-shadow:
    0 0 0 1px rgba(56, 189, 248, 0.08),
    0 8px 24px rgba(0, 0, 0, 0.28);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.aio-root .bp-ai-composer:focus-within,
.aio-composer-row:focus-within {
  border-color: var(--bp-composer-focus);
  box-shadow:
    0 0 0 2px rgba(56, 189, 248, 0.22),
    0 10px 28px rgba(0, 0, 0, 0.32);
}

.aio-root .bp-ai-composer textarea,
.aio-root .bp-ai-composer .bp-ai-input,
.aio-composer-row textarea,
.aio-composer-row .bp-ai-input,
.aio-followup-input {
  flex: 1;
  min-width: 0;
  min-height: 1.55rem;
  max-height: 7.5rem;
  margin: 0;
  padding: 0.4rem 0.15rem;
  border: none !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: var(--bp-composer-text, var(--aio-text));
  box-shadow: none !important;
  font: inherit;
  font-size: 0.88rem;
  line-height: 1.4;
  resize: none;
  outline: none;
}

.aio-root .bp-ai-composer textarea::placeholder,
.aio-composer-row textarea::placeholder,
.aio-followup-input::placeholder {
  color: var(--bp-composer-placeholder, var(--aio-muted));
}

.aio-handsfree.is-on {
  color: #5eead4;
  border-color: rgba(94, 234, 212, 0.45);
  background: rgba(94, 234, 212, 0.12);
}

.aio-mic {
  flex-shrink: 0;
  width: 2.35rem;
  height: 2.35rem;
  border-radius: 999px;
  border: none;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
  user-select: none;
}

.aio-mic:hover:not(:disabled) {
  color: #e2e8f0;
  background: rgba(255, 255, 255, 0.08);
}

.aio-mic:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.aio-voice-hint,
.aio-form .bp-ai-composer-hint,
.aio-followup .bp-ai-composer-hint {
  margin: 0;
  padding: 0 0.35rem;
  font-size: 0.68rem;
  line-height: 1.35;
  color: var(--aio-muted);
  text-align: start;
}

.aio-send,
.aio-root .bp-ai-send,
.aio-root .aio-followup .bp-ai-send,
.aio-root .aio-form .bp-ai-send {
  align-self: flex-end;
  flex-shrink: 0;
  width: 2.55rem;
  min-width: 2.55rem;
  height: 2.55rem;
  border-radius: 999px;
  border: none;
  background: #f8fafc !important;
  color: #0b1220 !important;
  font-weight: 700;
  font-size: 0;
  cursor: pointer;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}

.aio-root .bp-ai-send .bp-ai-send-icon {
  width: 1.05rem;
  height: 1.05rem;
  display: block;
  fill: currentColor;
}

.aio-send:disabled,
.aio-root .bp-ai-send:disabled,
.aio-root .aio-followup .bp-ai-send:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  background: #f8fafc !important;
  color: #0b1220 !important;
}

.aio-root .bp-ai-composer-toolbar {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  flex-shrink: 0;
}

.aio-footer-link {
  flex-shrink: 0;
  text-align: center;
  padding: 0 0.75rem 0.65rem;
  font-size: 0.72rem;
}

.aio-footer-link a {
  color: var(--aio-accent);
  text-decoration: none;
}

.aio-footer-link a:hover {
  text-decoration: underline;
}

.aio-empty {
  margin: auto;
  text-align: center;
  color: var(--aio-muted);
  font-size: 0.84rem;
  padding: 1.5rem 1rem;
  line-height: 1.45;
}

@media (max-width: 640px) {
  .aio-drawer {
    right: 0.5rem;
    left: 0.5rem;
    bottom: 4.8rem;
    width: auto;
    height: min(72vh, 580px);
  }

  html[dir="rtl"] .aio-drawer,
  body[dir="rtl"] .aio-drawer,
  .aio-root[data-rtl="1"] .aio-drawer {
    left: 0.5rem;
    right: 0.5rem;
  }

  .aio-root {
    inset: auto 0.85rem 0.85rem auto;
  }

  html[dir="rtl"] .aio-root,
  body[dir="rtl"] .aio-root,
  .aio-root[data-rtl="1"] {
    inset: auto auto 0.85rem 0.85rem;
  }
}

/* Never appear on paper / PDF printouts */
@media print {
  .aio-root,
  .aio-root *,
  .aio-backdrop,
  #aioOperatorRoot {
    display: none !important;
    visibility: hidden !important;
  }
}
