.ai-assistant-launcher {
  position: fixed;
  right: 14px;
  bottom: 14px;
  z-index: 14000;
  border: 1px solid color-mix(in srgb, var(--brand) 40%, var(--border));
  background: linear-gradient(145deg, color-mix(in srgb, var(--brand) 82%, #ffffff 18%), color-mix(in srgb, var(--brand-strong) 80%, #ffffff 20%));
  color: #fff;
  font-weight: 800;
  border-radius: 999px;
  padding: 10px 14px;
  box-shadow: var(--ui-elev-2);
}

.ai-assistant-panel {
  position: fixed;
  right: 14px;
  bottom: 62px;
  z-index: 14010;
  width: min(420px, calc(100vw - 22px));
  max-height: min(76vh, 760px);
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--ui-elev-2);
  display: none;
}

.ai-assistant-panel.is-open {
  display: block;
}

.ai-assistant-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

.ai-assistant-head strong {
  color: var(--text);
}

.ai-assistant-body {
  padding: 10px 12px;
}

.ai-assistant-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-bottom: 8px;
}

.ai-assistant-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.ai-assistant-quick .btn {
  border-radius: 999px;
}

.ai-assistant-output {
  border: 1px solid color-mix(in srgb, var(--border) 84%, transparent);
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface-soft) 85%, #ffffff 15%);
  padding: 9px;
}

.ai-res-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 6px;
}

.ai-res-summary {
  color: var(--muted);
  margin-bottom: 8px;
  font-size: 0.88rem;
}

.ai-res-metrics {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
  margin-bottom: 8px;
  font-size: 0.83rem;
  color: var(--text);
}

.ai-res-block h6 {
  margin: 8px 0 5px 0;
  color: var(--text);
  font-size: 0.84rem;
}

.ai-res-block ul {
  margin: 0;
  padding-left: 1rem;
}

.ai-res-block li {
  margin-bottom: 4px;
  color: var(--text);
  font-size: 0.83rem;
}

.ai-loading,
.ai-error {
  color: var(--muted);
  font-size: 0.85rem;
}

html.dark-mode .ai-assistant-panel,
body.dark-mode .ai-assistant-panel {
  background: #182337;
  border-color: #30435f;
}

html.dark-mode .ai-assistant-output,
body.dark-mode .ai-assistant-output {
  background: #202e44;
  border-color: #3c5172;
}

@media (max-width: 760px) {
  .ai-assistant-launcher {
    right: 10px;
    bottom: 10px;
    padding: 9px 12px;
  }

  .ai-assistant-panel {
    right: 10px;
    left: 10px;
    width: auto;
    bottom: 58px;
    max-height: 78vh;
  }
}
