.jinreen-assistant-dialog {
  width: min(440px, calc(100vw - 28px));
  max-width: 440px;
  height: min(720px, calc(100vh - 34px));
  max-height: 720px;
  margin: auto 18px 18px auto;
  padding: 0;
  border: 0;
  border-radius: 22px;
  background: transparent;
  overflow: visible;
}

.jinreen-assistant-dialog::backdrop {
  background: rgba(3, 22, 40, .34);
  backdrop-filter: blur(3px);
}

.jinreen-assistant-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  border: 1px solid rgba(142, 199, 234, .55);
  border-radius: 22px;
  color: #10253b;
  background: linear-gradient(180deg, #f8fcff 0%, #fff 38%, #f7fbff 100%);
  box-shadow: 0 30px 90px rgba(5, 40, 72, .3), inset 0 1px 0 rgba(255, 255, 255, .9);
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

.jinreen-assistant-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 17px 18px 14px;
  color: white;
  background:
    radial-gradient(circle at 86% 0%, rgba(97, 194, 255, .55), transparent 38%),
    linear-gradient(125deg, #0b3f78, #1268b3 55%, #1d8ad0);
}

.jinreen-assistant-brand,
.jinreen-assistant-head-actions {
  display: flex;
  align-items: center;
  gap: 11px;
}

.jinreen-assistant-brand div {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.jinreen-assistant-brand strong {
  font-size: 15px;
  letter-spacing: .02em;
}

.jinreen-assistant-brand small {
  color: rgba(226, 246, 255, .78);
  font-size: 10px;
}

.jinreen-assistant-mark {
  display: grid;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(255, 255, 255, .38);
  border-radius: 12px;
  color: #fff;
  background: rgba(255, 255, 255, .14);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .06em;
  place-items: center;
}

.jinreen-assistant-head-actions button {
  border: 0;
  color: white;
  background: transparent;
  cursor: pointer;
}

.jinreen-assistant-ghost {
  padding: 7px 9px;
  border-radius: 8px;
  font-size: 11px;
  background: rgba(255, 255, 255, .1) !important;
}

.jinreen-assistant-close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 22px;
  line-height: 1;
}

.jinreen-assistant-head-actions button:hover {
  background: rgba(255, 255, 255, .18) !important;
}

.jinreen-assistant-context {
  padding: 9px 18px;
  border-bottom: 1px solid #e7f1f8;
  color: #52728c;
  background: #f0f8fe;
  font-size: 10px;
  line-height: 1.55;
}

.jinreen-assistant-messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px 16px 8px;
  scrollbar-width: thin;
  scrollbar-color: #bcd9eb transparent;
}

.jinreen-assistant-message {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-bottom: 15px;
}

.jinreen-assistant-message--user {
  flex-direction: row-reverse;
}

.jinreen-assistant-avatar {
  flex: 0 0 28px;
  display: grid;
  width: 28px;
  height: 28px;
  border-radius: 9px;
  color: #fff;
  background: linear-gradient(135deg, #1268b3, #35a2df);
  font-size: 9px;
  font-weight: 700;
  place-items: center;
}

.jinreen-assistant-message--user .jinreen-assistant-avatar {
  color: #1a507b;
  background: #e5f3fc;
}

.jinreen-assistant-bubble {
  max-width: calc(100% - 50px);
  padding: 10px 12px;
  border: 1px solid #e2eef7;
  border-radius: 4px 14px 14px;
  background: #fff;
  box-shadow: 0 5px 18px rgba(13, 63, 100, .055);
}

.jinreen-assistant-message--user .jinreen-assistant-bubble {
  color: white;
  border-color: transparent;
  border-radius: 14px 4px 14px 14px;
  background: linear-gradient(135deg, #1268b3, #2189cb);
}

.jinreen-assistant-text {
  margin: 0;
  font-size: 13px;
  line-height: 1.72;
  white-space: pre-wrap;
  word-break: break-word;
}

.jinreen-assistant-bubble.is-streaming .jinreen-assistant-text::after {
  content: '';
  display: inline-block;
  width: 6px;
  height: 14px;
  margin-left: 3px;
  vertical-align: -2px;
  background: #2189cb;
  animation: jinreen-assistant-blink .8s steps(2, start) infinite;
}

.jinreen-assistant-bubble.is-error {
  color: #8b2c2c;
  border-color: #f1cccc;
  background: #fff7f7;
}

@keyframes jinreen-assistant-blink { 50% { opacity: .15; } }

.jinreen-assistant-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px 16px 10px;
}

.jinreen-assistant-suggestions button {
  padding: 6px 9px;
  border: 1px solid #d7e8f4;
  border-radius: 999px;
  color: #2d648d;
  background: #f7fbfe;
  font: inherit;
  font-size: 10px;
  cursor: pointer;
}

.jinreen-assistant-suggestions button:hover {
  color: #0d5e9f;
  border-color: #8cc4e8;
  background: #edf8ff;
}

.jinreen-assistant-lead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 14px 8px;
  padding: 9px 11px;
  border: 1px solid #d8e9f4;
  border-radius: 10px;
  background: linear-gradient(135deg, #f5fbff, #ffffff);
}

.jinreen-assistant-lead > span {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.jinreen-assistant-lead strong {
  color: #2c5876;
  font-size: 10px;
  font-weight: 650;
}

.jinreen-assistant-lead small {
  color: #52697a;
  font-size: 8px;
}

.jinreen-assistant-lead a {
  flex: none;
  padding: 6px 9px;
  border-radius: 7px;
  color: #fff;
  background: linear-gradient(135deg, #0e5b9c, #258ccc);
  font-size: 9px;
  font-weight: 650;
  text-decoration: none;
}

.jinreen-assistant-form {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 14px 8px;
  border-top: 1px solid #e8f1f7;
  background: #fff;
}

.jinreen-assistant-input-wrap {
  flex: 1;
}

.jinreen-assistant-form textarea {
  display: block;
  width: 100%;
  min-height: 44px;
  max-height: 108px;
  resize: vertical;
  padding: 11px 12px;
  border: 1px solid #d7e6f0;
  border-radius: 12px;
  outline: none;
  color: #15334d;
  background: #f9fcff;
  font: inherit;
  font-size: 12px;
  line-height: 1.5;
}

.jinreen-assistant-form textarea:focus {
  border-color: #5aa8da;
  box-shadow: 0 0 0 3px rgba(64, 159, 216, .12);
}

.jinreen-assistant-send {
  min-width: 58px;
  height: 44px;
  border: 0;
  border-radius: 11px;
  color: #fff;
  background: linear-gradient(135deg, #0e5b9c, #258ccc);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.jinreen-assistant-send:disabled {
  opacity: .62;
  cursor: wait;
}

.jinreen-assistant-foot {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 0 15px 11px;
  color: #536b7c;
  background: #fff;
  font-size: 9px;
}

.jinreen-assistant-foot a {
  color: #246a9c;
}

.jinreen-assistant-status {
  min-height: 20px;
  margin: 0;
  padding: 0 15px 8px;
  color: #52697a;
  background: #fff;
  font-size: 10px;
}

.jinreen-assistant-status.is-error { color: #a33a3a; }
.jinreen-assistant-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

button.float-action { font: inherit; cursor: pointer; }

@media (max-width: 600px) {
  .jinreen-assistant-dialog {
    width: 100vw;
    max-width: none;
    height: 100dvh;
    max-height: none;
    margin: 0;
    border-radius: 0;
  }

  .jinreen-assistant-panel { border-radius: 0; border: 0; }
  .float-action.float-action--assistant { display: grid !important; }
  .jinreen-assistant-suggestions { display: grid; grid-template-columns: 1fr 1fr; }
  .jinreen-assistant-suggestions button { white-space: normal; text-align: left; line-height: 1.45; }
  .jinreen-assistant-lead { align-items: stretch; flex-direction: column; }
  .jinreen-assistant-lead a { text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  .jinreen-assistant-bubble.is-streaming .jinreen-assistant-text::after { animation: none; }
}
