.runner-melissa-ai {
  --mai-blue: #00a3e0;
  --mai-dark: #252b33;
  --mai-text: #1f2933;
  --mai-muted: #6b7280;
  --mai-border: #d9e2ec;
  --mai-soft: #f5f9fc;
  --mai-warn: #fff7ed;
  --mai-warn-border: #fed7aa;
  color: var(--mai-text);
  font-family: Helvetica Neue, Helvetica, Arial, sans-serif;
}

.runner-melissa-ai button,
.runner-melissa-ai input,
.runner-melissa-ai textarea {
  font: inherit;
}

.mai-launcher {
  align-items: center;
  background: var(--mai-dark);
  border: 0;
  border-radius: 8px;
  bottom: 18px;
  box-shadow: 0 14px 38px rgba(15, 23, 42, 0.28);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  font-size: 15px;
  font-weight: 700;
  gap: 9px;
  left: 18px;
  line-height: 1;
  min-height: 48px;
  padding: 0 16px 0 12px;
  position: fixed;
  z-index: 2147482600;
}

.mai-launcher:hover,
.mai-launcher:focus-visible {
  background: #111827;
  outline: 3px solid rgba(0, 163, 224, 0.28);
}

.mai-launcher-badge,
.mai-logo {
  align-items: center;
  background: var(--mai-blue);
  border-radius: 6px;
  color: #fff;
  display: inline-flex;
  font-size: 11px;
  font-weight: 800;
  height: 27px;
  justify-content: center;
  letter-spacing: 0;
  width: 27px;
}

.mai-panel {
  background: #fff;
  border: 1px solid var(--mai-border);
  border-radius: 8px;
  bottom: 78px;
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.22);
  display: none;
  flex-direction: column;
  height: min(680px, calc(100vh - 112px));
  left: 18px;
  max-width: calc(100vw - 36px);
  overflow: hidden;
  position: fixed;
  width: 430px;
  z-index: 2147482601;
}

.mai-panel[data-open="true"] {
  display: flex;
}

.mai-header {
  align-items: center;
  border-bottom: 1px solid var(--mai-border);
  display: flex;
  gap: 12px;
  min-height: 72px;
  padding: 14px 16px;
}

.mai-title {
  flex: 1;
  min-width: 0;
}

.mai-title h2 {
  color: #111827;
  font-size: 18px;
  line-height: 1.2;
  margin: 0;
}

.mai-title p {
  color: var(--mai-muted);
  font-size: 12px;
  line-height: 1.25;
  margin: 4px 0 0;
}

.mai-close,
.mai-send {
  align-items: center;
  background: #eef6fb;
  border: 1px solid transparent;
  border-radius: 8px;
  color: #334155;
  cursor: pointer;
  display: inline-flex;
  height: 36px;
  justify-content: center;
  width: 36px;
}

.mai-close:hover,
.mai-send:hover,
.mai-close:focus-visible,
.mai-send:focus-visible {
  border-color: var(--mai-blue);
  outline: none;
}

.mai-send {
  background: var(--mai-blue);
  color: #fff;
  flex: 0 0 auto;
}

.mai-send:disabled {
  background: #d7e3eb;
  color: #94a3b8;
  cursor: default;
}

.mai-body {
  background: linear-gradient(#fff, #fff), var(--mai-soft);
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px;
}

.mai-notice {
  background: var(--mai-soft);
  border: 1px solid #e5eef5;
  border-radius: 8px;
  color: #52606d;
  font-size: 12px;
  line-height: 1.45;
  margin-bottom: 12px;
  padding: 10px 12px;
}

.mai-message {
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.48;
  margin: 12px 0;
  padding: 12px;
}

.mai-message[data-role="user"] {
  background: #e6f6fd;
  margin-left: 34px;
}

.mai-message[data-role="assistant"] {
  background: #fff;
  border: 1px solid var(--mai-border);
}

.mai-message strong {
  color: #111827;
}

.mai-message p {
  margin: 0 0 10px;
}

.mai-message p:last-child,
.mai-message ul:last-child,
.mai-message ol:last-child {
  margin-bottom: 0;
}

.mai-message ul,
.mai-message ol {
  margin: 8px 0 10px 18px;
  padding: 0;
}

.mai-message li {
  margin: 5px 0;
}

.mai-message a {
  color: #0077aa;
  font-weight: 700;
  text-decoration: underline;
}

.mai-source-list {
  border-top: 1px solid var(--mai-border);
  display: grid;
  gap: 6px;
  margin-top: 10px;
  padding-top: 10px;
}

.mai-source-list a {
  display: block;
  font-size: 13px;
}

.mai-action {
  background: var(--mai-warn);
  border: 1px solid var(--mai-warn-border);
  border-radius: 8px;
  margin-top: 10px;
  padding: 9px 10px;
}

.mai-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

.mai-chip {
  background: #fff;
  border: 1px solid var(--mai-border);
  border-radius: 8px;
  color: #334155;
  cursor: pointer;
  font-size: 12px;
  padding: 8px 10px;
}

.mai-chip:hover,
.mai-chip:focus-visible {
  border-color: var(--mai-blue);
  outline: none;
}

.mai-footer {
  border-top: 1px solid var(--mai-border);
  padding: 12px;
}

.mai-form {
  border: 1px solid var(--mai-border);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  padding: 10px;
}

.mai-input-row {
  align-items: end;
  display: flex;
  gap: 8px;
}

.mai-input {
  border: 0;
  color: #111827;
  flex: 1;
  line-height: 1.4;
  max-height: 110px;
  min-height: 42px;
  outline: none;
  resize: none;
}

.mai-tools {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.mai-toggle {
  align-items: center;
  color: #334155;
  cursor: pointer;
  display: inline-flex;
  font-size: 12px;
  gap: 7px;
}

.mai-toggle input {
  accent-color: var(--mai-blue);
}

.mai-powered {
  color: #7b8794;
  font-size: 12px;
  white-space: nowrap;
}

.mai-risk {
  background: #f8fafc;
  border-left: 3px solid var(--mai-blue);
  margin-top: 10px;
  padding: 9px 10px;
}

.mai-loading {
  color: var(--mai-muted);
  font-size: 13px;
}

@media (max-width: 560px) {
  .mai-panel {
    bottom: 0;
    height: min(86vh, 760px);
    left: 0;
    max-width: none;
    width: 100vw;
  }

  .mai-launcher {
    bottom: 14px;
    left: 14px;
  }
}
