.celia-launcher {
  position: fixed;
  left: 50%;
  bottom: 18px;
  z-index: 9998;
  width: min(750px, calc(100vw - 32px));
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 10px;
  transform: translateX(-50%);
  border: var(--celia-border-width, 2px) solid var(--celia-border-color, #4f46e5);
  border-radius: var(--celia-border-radius, 8px);
  background: var(--celia-launcher-bg, #fff);
  color: var(--celia-launcher-text, #4f46e5);
  box-shadow: var(--celia-box-shadow, 0 14px 34px rgba(15, 23, 42, 0.18));
  cursor: pointer;
  font: inherit;
  text-align: left;
  padding: 6px 16px 6px 8px;
  opacity: 1;
}

.celia-launcher-content {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.celia-avatar {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 2px 8px rgba(31, 35, 40, 0.18);
}

.celia-launcher-avatar {
  width: 38px;
  height: 38px;
  flex-basis: 38px;
}

.celia-brand {
  color: #1f2328;
  font-weight: 700;
  letter-spacing: 0;
  white-space: nowrap;
}

.celia-brand-ia {
  color: var(--celia-brand-accent, #136fdd);
  font-weight: 800;
}

.celia-launcher-brand {
  grid-column: 1;
  font-size: 15px;
}

.celia-launcher-textarea {
  grid-column: 2;
  width: 100%;
  min-width: 0;
  min-height: 38px;
  resize: none;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--celia-launcher-text, #4f46e5);
  cursor: text;
  font: inherit;
  line-height: 1.35;
  overflow: hidden;
  padding: 9px 0;
}

.celia-launcher-summary {
  grid-column: 2;
  min-width: 0;
  color: #1f2328;
}

.celia-summary-label {
  display: block;
  margin-bottom: 2px;
  font-size: 11px;
  line-height: 1.1;
  color: #57606a;
}

.celia-summary-text {
  display: block;
  overflow: hidden;
  color: #1f2328;
  font-size: 13px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.celia-reply-button {
  min-height: 36px;
  padding: 0 14px;
  border: 0;
  border-radius: var(--celia-border-radius, 8px);
  background: var(--celia-send-bg, #136fdd);
  color: var(--celia-send-text, #fff);
  cursor: pointer;
  font: inherit;
  font-weight: 700;
}

.celia-reply-button:hover,
.celia-reply-button:focus {
  text-decoration: underline;
}

.celia-launcher-textarea::placeholder {
  color: var(--celia-launcher-text, #4f46e5);
  opacity: 1;
}

.celia-overlay {
  position: fixed;
  inset: 0;
  z-index: 9997;
  background: rgba(31, 35, 40, 0.42);
}

.celia-panel {
  position: fixed;
  left: 50%;
  bottom: 18px;
  z-index: 9999;
  width: min(680px, calc(100vw - 32px));
  height: min(620px, calc(100vh - 54px));
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: var(--celia-border-radius, 8px);
  background: var(--celia-panel-bg, #fff);
  color: #1f2328;
  box-shadow: 0 22px 70px rgba(31, 35, 40, 0.28);
}

.celia-panel[hidden], .celia-overlay[hidden] {
  display: none;
}

.celia-launcher[hidden] {
  display: none;
}

.celia-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 52px;
  padding: 0 16px;
  border-bottom: 1px solid #d8dee4;
}

.celia-title {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.celia-window-controls {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.celia-close,
.celia-minimize {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 36px;
  border: 1px solid transparent;
  border-radius: var(--celia-border-radius, 8px);
  cursor: pointer;
  transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.celia-minimize {
  background: #ecfdf5;
  border-color: #a7f3d0;
  color: #047857;
}

.celia-close {
  background: #fff1f2;
  border-color: #fecdd3;
  color: #be123c;
}

.celia-control-icon {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.5;
}

.celia-close:hover,
.celia-close:focus,
.celia-minimize:hover,
.celia-minimize:focus {
  transform: translateY(-1px);
}

.celia-minimize:hover,
.celia-minimize:focus {
  background: #d1fae5;
  border-color: #6ee7b7;
  color: #065f46;
}

.celia-close:hover,
.celia-close:focus {
  background: #ffe4e6;
  border-color: #fda4af;
  color: #9f1239;
}

.celia-messages {
  flex: 1;
  overflow: auto;
  padding: 16px;
  background: #f6f8fa;
}

.celia-message {
  max-width: 86%;
  margin: 0 0 10px;
  padding: 10px 12px;
  border-radius: 8px;
  white-space: pre-wrap;
  line-height: 1.45;
  font-weight: 400;
}

.celia-message-assistant {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.celia-message-avatar {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  border-radius: 50%;
  object-fit: cover;
}

.celia-message-body {
  min-width: 0;
  font-weight: 400 !important;
}

.celia-message-body p {
  margin: 0 0 8px;
  font-weight: 400 !important;
}

.celia-message-body p:last-child,
.celia-message-body ul:last-child {
  margin-bottom: 0;
}

.celia-message-body ul {
  margin: 0 0 8px;
  padding-left: 18px;
  font-weight: 400 !important;
}

.celia-message-body li {
  font-weight: 400 !important;
}

.celia-message-body li + li {
  margin-top: 4px;
}

.celia-message-user {
  margin-left: auto;
  background: #0969da;
  color: #fff;
}

.celia-message-assistant,
.celia-message-sources {
  background: #fff;
  border: 1px solid #d8dee4;
}

.celia-message-sources {
  max-width: 100%;
  font-size: 12px;
  color: #57606a;
}

.celia-message-actions {
  max-width: 100%;
  display: flex;
  justify-content: center;
  background: transparent;
  border: 0;
  padding: 0;
}

.celia-action-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 14px;
  border-radius: var(--celia-border-radius, 8px);
  background: var(--celia-send-bg, #136fdd);
  color: var(--celia-send-text, #fff);
  text-decoration: none;
  font-weight: 700;
}

.celia-action-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.2;
}

.celia-action-link:hover,
.celia-action-link:focus {
  color: var(--celia-send-text, #fff);
  text-decoration: underline;
}

.celia-sources-title {
  margin-bottom: 6px;
  font-weight: 700;
  color: #1f2328;
}

.celia-message-sources ul {
  margin: 0;
  padding-left: 18px;
}

.celia-message-sources li + li {
  margin-top: 4px;
}

.celia-message-sources a {
  color: #0969da;
  text-decoration: underline;
  text-underline-offset: 2px;
  overflow-wrap: anywhere;
}

.celia-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid #d8dee4;
}

.celia-terms-gate {
  flex: 0 0 100%;
  padding: 8px 10px;
  border: 1px solid #d8dee4;
  border-radius: var(--celia-border-radius, 8px);
  background: #fff;
  color: #374151;
  font-size: 13px;
  line-height: 1.35;
}

.celia-terms-gate[hidden] {
  display: none;
}

.celia-terms-label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0;
  font-weight: 400;
}

.celia-terms-checkbox {
  flex: 0 0 auto;
  margin-top: 2px;
}

.celia-terms-label a {
  color: #0969da;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.celia-input {
  flex: 1;
  min-width: 0;
  min-height: 42px;
  max-height: 140px;
  border: 1px solid #d0d7de;
  border-radius: var(--celia-border-radius, 8px);
  padding: 10px 12px;
  resize: none;
  line-height: 1.35;
}

.celia-input::placeholder {
  color: #6b7280;
  opacity: 1;
}

.celia-send {
  min-width: 92px;
  border: 0;
  border-radius: var(--celia-border-radius, 8px);
  background: var(--celia-send-bg, #136fdd);
  color: var(--celia-send-text, #fff);
  cursor: pointer;
}

@media (max-width: 640px) {
  .celia-launcher {
    left: auto;
    right: 18px;
    width: 58px;
    height: 58px;
    min-height: 58px;
    padding: 0;
    border-radius: 50%;
    transform: none;
    text-align: center;
  }

  .celia-launcher-textarea {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
  }

  .celia-launcher-brand {
    display: none;
  }

  .celia-launcher.celia-launcher-has-summary {
    left: 18px;
    right: 18px;
    width: auto;
    height: auto;
    min-height: 58px;
    border-radius: var(--celia-border-radius, 8px);
    padding: 6px 8px;
    text-align: left;
  }

  .celia-launcher.celia-launcher-has-summary .celia-launcher-brand {
    display: inline;
  }

  .celia-launcher-avatar {
    width: 52px;
    height: 52px;
    flex-basis: 52px;
    margin: auto;
  }

  .celia-panel {
    inset: 12px;
    width: auto;
    height: auto;
    transform: none;
  }
}
