#rms-wac-root {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 9999;
  font-family: "Segoe UI", Tahoma, sans-serif;
  display: flex;
  flex-direction: column-reverse;
  align-items: flex-end;
  gap: 14px;
}

#rms-wac-root [hidden] {
  display: none !important;
}

.rms-wac-launcher {
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, #0f766e, #0b3b45);
  color: #fff;
  padding: 14px 20px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 16px 40px rgba(11, 59, 69, 0.22);
}

.rms-wac-panel {
  width: min(380px, calc(100vw - 32px));
  max-height: calc(100vh - 96px);
  border-radius: 22px;
  overflow: hidden;
  background: #f7f5ef;
  border: 1px solid rgba(11, 59, 69, 0.12);
  box-shadow: 0 24px 60px rgba(11, 59, 69, 0.18);
  display: flex;
  flex-direction: column;
}

.rms-wac-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 18px 14px;
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.55), transparent 45%),
    linear-gradient(135deg, #d8f0ea, #f2e8d5);
  border-bottom: 1px solid rgba(11, 59, 69, 0.08);
}

.rms-wac-header h2 {
  margin: 0 0 6px;
  font-size: 18px;
  line-height: 1.2;
  color: #0b3b45;
}

.rms-wac-header p {
  margin: 0;
  color: #345b63;
  font-size: 13px;
  line-height: 1.5;
}

.rms-wac-header .rms-wac-privacy {
  margin-top: 8px;
  font-size: 12px;
  color: #5f6c72;
}

.rms-wac-modes {
  display: grid;
  flex: 0 0 auto;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 12px 16px 0;
  background: #fffdf8;
}

.rms-wac-view {
  min-height: 0;
}

.rms-wac-modes button {
  border: 1px solid rgba(11, 59, 69, 0.16);
  border-radius: 10px;
  background: #fff;
  color: #345b63;
  padding: 8px 10px;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.rms-wac-modes button.is-active {
  background: #0b3b45;
  color: #fff;
}

.rms-wac-close {
  border: 0;
  background: transparent;
  color: #0b3b45;
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
}

.rms-wac-messages {
  max-height: 420px;
  overflow-y: auto;
  padding: 16px;
  display: grid;
  gap: 12px;
}

.rms-wac-message {
  max-width: 90%;
  padding: 12px 14px;
  border-radius: 18px;
  line-height: 1.5;
  font-size: 14px;
  white-space: pre-wrap;
}

.rms-wac-user {
  margin-left: auto;
  background: #0b3b45;
  color: #fff;
  border-bottom-right-radius: 6px;
}

.rms-wac-assistant,
.rms-wac-assistant-thinking,
.rms-wac-assistant-refused,
.rms-wac-assistant-error {
  background: #fff;
  color: #1c3137;
  border: 1px solid rgba(11, 59, 69, 0.1);
  border-bottom-left-radius: 6px;
}

.rms-wac-assistant-refused {
  background: #fff7f4;
}

.rms-wac-assistant-thinking {
  color: #5f6c72;
  font-style: italic;
}

.rms-wac-form {
  display: grid;
  gap: 10px;
  padding: 16px;
  border-top: 1px solid rgba(11, 59, 69, 0.08);
  background: #fffdf8;
}

.rms-wac-form textarea,
.rms-wac-order-form input {
  width: 100%;
  border: 1px solid rgba(11, 59, 69, 0.18);
  border-radius: 14px;
  padding: 12px 14px;
  font: inherit;
  color: #1c3137;
  background: #fff;
}

.rms-wac-form textarea {
  min-height: 84px;
  resize: vertical;
}

.rms-wac-form button,
.rms-wac-order-form button {
  justify-self: end;
  border: 0;
  border-radius: 999px;
  background: #c05621;
  color: #fff;
  padding: 10px 18px;
  font-weight: 700;
  cursor: pointer;
}

.rms-wac-order-view {
  padding: 16px;
  background: #fffdf8;
  overflow-y: auto;
}

.rms-wac-order-form {
  display: grid;
  gap: 12px;
}

.rms-wac-order-form label {
  display: grid;
  gap: 6px;
  color: #1c3137;
  font-size: 13px;
  font-weight: 700;
}

.rms-wac-order-result {
  margin-top: 14px;
  border-radius: 14px;
  border: 1px solid rgba(11, 59, 69, 0.1);
  background: #fff;
  padding: 12px 14px;
  color: #1c3137;
  font-size: 14px;
  line-height: 1.5;
}

.rms-wac-order-result:empty {
  display: none;
}

.rms-wac-order-result.is-error {
  background: #fff7f4;
}

.rms-wac-order-result p {
  margin: 0;
}

.rms-wac-order-result dl {
  display: grid;
  grid-template-columns: minmax(90px, max-content) 1fr;
  gap: 6px 12px;
  margin: 10px 0 0;
}

.rms-wac-order-result dt,
.rms-wac-order-result dd {
  margin: 0;
}

.rms-wac-order-result dt {
  color: #5f6c72;
  font-weight: 700;
}

.rms-wac-order-result a {
  color: #0f766e;
  text-decoration: none;
  font-weight: 700;
}

.rms-wac-citations,
.rms-wac-suggestions,
.rms-wac-handoff {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12px;
}

.rms-wac-citations a,
.rms-wac-suggestions a,
.rms-wac-suggestions span,
.rms-wac-handoff a {
  color: #0f766e;
  text-decoration: none;
}

.rms-wac-suggestions a,
.rms-wac-suggestions span {
  border: 1px solid rgba(15, 118, 110, 0.18);
  border-radius: 999px;
  padding: 4px 8px;
  background: #f1fbf8;
  font-weight: 700;
}

@media (max-width: 640px) {
  #rms-wac-root {
    right: 12px;
    left: 12px;
    bottom: 12px;
  }

  .rms-wac-launcher {
    width: 100%;
  }

  .rms-wac-panel {
    width: 100%;
  }
}
