/* OffiNeeds AI Dashboard Builder — injected into Metabase
   Brand palette: red #ef4444 / dark #1e1e2a / grey #4a4a55 */
#on-ai-tab {
  position: fixed;
  top: 50%;
  right: 0;
  transform: translateY(-50%) rotate(-90deg);
  transform-origin: bottom right;
  background: #ef4444;
  color: #fff;
  padding: 10px 22px;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.6px;
  cursor: pointer;
  z-index: 99998;
  border-radius: 6px 6px 0 0;
  box-shadow: 0 -2px 12px rgba(0,0,0,0.18);
  user-select: none;
}
#on-ai-tab:hover { background: #dc2626; }

#on-ai-panel {
  position: fixed;
  top: 0; right: -640px;
  width: 620px; height: 100vh;
  background: #fff;
  border-left: 1px solid #e2e4ea;
  box-shadow: -4px 0 24px rgba(0,0,0,0.14);
  display: flex; flex-direction: column;
  z-index: 99999;
  transition: right 0.25s ease-out;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
#on-ai-panel.open { right: 0; }
#on-ai-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px;
  background: linear-gradient(135deg,#1e1e2a 0%, #2a1a1a 60%, #ef4444 130%);
  color: #fff;
}
#on-ai-header h3 { margin: 0; font-size: 16px; font-weight: 700; letter-spacing: 0.3px; }
#on-ai-close {
  background: transparent; border: none; color: #fff;
  font-size: 22px; cursor: pointer; padding: 0 6px;
  line-height: 1;
}
#on-ai-close:hover { color: #ef4444; }
#on-ai-log {
  flex: 1; overflow-y: auto; padding: 14px 18px;
  background: #f5f5f7;
  font-size: 13px; line-height: 1.5;
  color: #1e1e2a;
}
.on-ai-msg { margin-bottom: 14px; }
.on-ai-msg-user {
  background: #ef4444; color: #fff; padding: 9px 13px;
  border-radius: 14px 14px 2px 14px;
  align-self: flex-end; max-width: 88%;
  margin-left: auto; display: block; width: fit-content;
}
.on-ai-msg-assistant {
  background: #fff; color: #1e1e2a; padding: 11px 14px;
  border-radius: 14px 14px 14px 2px;
  border: 1px solid #e2e4ea;
  white-space: pre-wrap; word-wrap: break-word;
}
.on-ai-step {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 11.5px;
  background: #fff;
  border: 1px solid #e2e4ea;
  border-left: 3px solid #ef4444;
  padding: 8px 12px;
  margin: 6px 0;
  border-radius: 4px;
  color: #1e1e2a;
}
.on-ai-step .step-num {
  display: inline-block;
  background: #1e1e2a; color: #fff;
  border-radius: 10px;
  padding: 1px 8px;
  font-size: 10px;
  font-weight: 700;
  margin-right: 8px;
  vertical-align: middle;
}
.on-ai-step .step-name {
  color: #4a4a55;
  font-weight: 600;
}
.on-ai-step .step-detail {
  color: #6b6b75;
  display: block;
  margin-top: 4px;
  white-space: pre-wrap;
  word-break: break-word;
}
.on-ai-step.ok { border-left-color: #16a34a; }
.on-ai-step.ok::before { content: "✓ "; color: #16a34a; font-weight: 700; }
.on-ai-step.err { border-left-color: #dc2626; background: #fef2f2; }
.on-ai-step.err::before { content: "✗ "; color: #dc2626; font-weight: 700; }
.on-ai-step.run::before { content: "▸ "; color: #ef4444; font-weight: 700; }
.on-ai-msg-assistant a { color: #ef4444; font-weight: 600; }
.on-ai-msg-assistant code {
  background: #f5f5f7; padding: 1px 5px;
  border-radius: 3px; font-size: 12px;
}
#on-ai-form {
  border-top: 1px solid #e2e4ea; padding: 12px;
  background: #fff; display: flex; gap: 8px;
  align-items: flex-end;
}
#on-ai-input {
  flex: 1; resize: vertical; border: 1px solid #d4d4d8;
  border-radius: 8px; padding: 12px 14px; font-size: 14px;
  font-family: inherit; min-height: 110px; max-height: 260px;
  outline: none; line-height: 1.45;
  color: #1e1e2a;
}
#on-ai-input:focus { border-color: #ef4444; box-shadow: 0 0 0 2px rgba(239,68,68,0.15); }
#on-ai-send {
  background: #ef4444; color: #fff; border: none;
  border-radius: 8px; padding: 0 20px; font-weight: 600;
  cursor: pointer; font-size: 13px;
  height: 44px;
}
#on-ai-send:hover:not(:disabled) { background: #dc2626; }
#on-ai-send:disabled { background: #d4d4d8; cursor: not-allowed; }
#on-ai-status {
  font-size: 12px; color: #4a4a55; padding: 6px 18px;
  background: #fff; border-top: 1px solid #e2e4ea;
  display: flex; align-items: center; gap: 8px;
}
#on-ai-status .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #16a34a; flex-shrink: 0;
}
#on-ai-status.busy .dot {
  background: #ef4444;
  animation: on-ai-pulse 1s ease-in-out infinite;
}
@keyframes on-ai-pulse {
  0%,100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(1.4); }
}
