.melos-launcher {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 1400;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 42px;
  padding: 5px 13px 5px 5px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 999px;
  color: #fff;
  background: linear-gradient(135deg, #152b65 0%, #2f4aa0 100%);
  box-shadow: 0 8px 22px rgba(16, 35, 82, 0.2);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.melos-launcher:hover { transform: translateY(-2px); }

.melos-launcher-mark,
.melos-avatar {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  color: #142862;
  background: linear-gradient(135deg, #ffc54a, #fff2bf);
  font-weight: 900;
}

.melos-panel {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 1500;
  display: grid;
  grid-template-rows: auto auto minmax(180px, 1fr) auto auto auto;
  width: min(430px, calc(100vw - 32px));
  height: min(680px, calc(100vh - 48px));
  overflow: hidden;
  border: 1px solid #dce4f2;
  border-radius: 22px;
  color: #0f1d3d;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 28px 80px rgba(11, 27, 64, 0.3);
}

.melos-panel.hidden,
.melos-launcher.hidden { display: none !important; }

.melos-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  color: #fff;
  background: linear-gradient(135deg, #101f4d 0%, #273f87 100%);
}

.melos-identity { display: flex; align-items: center; gap: 12px; }
.melos-header .eyebrow { margin: 0 0 2px; color: #c8d5fb; font-size: 0.68rem; }
.melos-header h2 { margin: 0; color: #fff; font-size: 1.35rem; }
.melos-avatar { width: 42px; height: 42px; }

.melos-icon-button {
  width: 38px;
  height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
}

.melos-security-bar {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 10px 18px;
  border-bottom: 1px solid #e5ebf5;
  color: #52617c;
  background: #f4f8ff;
  font-size: 0.78rem;
}

.melos-security-bar strong { color: #107052; }
.melos-readonly-dot { width: 8px; height: 8px; border-radius: 50%; background: #16a274; }

.melos-messages {
  overflow-y: auto;
  padding: 18px;
  background:
    radial-gradient(circle at 100% 0, rgba(62, 93, 179, 0.07), transparent 32%),
    #f8faff;
}

.melos-message {
  width: fit-content;
  max-width: 88%;
  margin: 0 0 12px;
  padding: 12px 14px;
  border-radius: 16px;
  box-shadow: 0 4px 14px rgba(27, 47, 91, 0.07);
  line-height: 1.5;
  white-space: pre-wrap;
}

.melos-message p { margin: 0; }
.melos-message-assistant { border: 1px solid #dfe7f5; border-bottom-left-radius: 5px; background: #fff; }
.melos-message-user { margin-left: auto; border-bottom-right-radius: 5px; color: #fff; background: #273f87; }
.melos-message-error { border-color: #f2c6c6; color: #9b2e2e; background: #fff5f5; }
.melos-message-loading { color: #63718b; font-style: italic; }

.melos-suggestions {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 10px 14px;
  border-top: 1px solid #e7edf7;
  background: #fff;
}

.melos-suggestions button {
  flex: 0 0 auto;
  padding: 8px 11px;
  border: 1px solid #ccd8ef;
  border-radius: 999px;
  color: #233b7b;
  background: #f8faff;
  font: inherit;
  font-size: 0.76rem;
  font-weight: 750;
  cursor: pointer;
}

.melos-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid #e3e9f4;
  background: #fff;
}

.melos-form label {
  display: block;
  color: #17264a;
  font-size: 0.82rem;
  font-weight: 800;
}

.melos-form textarea {
  box-sizing: border-box;
  width: 100%;
  min-height: 104px;
  max-height: 220px;
  resize: vertical;
  padding: 12px 13px;
  border: 1px solid #cbd6ea;
  border-radius: 13px;
  color: #102044;
  background: #fbfcff;
  font: inherit;
}

.melos-form textarea:focus { outline: 3px solid rgba(46, 76, 155, 0.14); border-color: #3656a8; }
.melos-form button { width: 100%; min-height: 42px; border: 0; border-radius: 13px; color: #fff; background: #243d84; font: inherit; font-weight: 800; cursor: pointer; }
.melos-form button:disabled { opacity: 0.55; cursor: wait; }
.melos-footer { padding: 0 16px 13px; color: #76839a; background: #fff; font-size: 0.68rem; line-height: 1.35; }

@media (max-width: 620px) {
  .melos-launcher { right: 14px; bottom: 14px; }
  .melos-panel { right: 0; bottom: 0; width: 100vw; height: 100dvh; border-radius: 0; }
}
