/* Morelink Quote Bot */
.mlqb {
  --mlqb-brand: #0B3D5C;
  --mlqb-offset: 96px;
  --mlqb-bg: #ffffff;
  --mlqb-soft: #f2f5f8;
  --mlqb-line: #dde3ea;
  --mlqb-ink: #16232e;
  --mlqb-muted: #5b6b78;
  --mlqb-ok: #e7f5ee;
  --mlqb-warn: #fdf1e6;
  position: fixed;
  bottom: var(--mlqb-offset);
  right: 20px;
  z-index: 99990;
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "PingFang SC", "Hiragino Sans", "Microsoft YaHei", sans-serif;
  color: var(--mlqb-ink);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
}
.mlqb[data-pos="left"] { right: auto; left: 20px; align-items: flex-start; }
.mlqb *, .mlqb *::before, .mlqb *::after { box-sizing: border-box; }
:where(.mlqb) :where(button, input, textarea) { font: inherit; color: inherit; margin: 0; text-transform: none; letter-spacing: normal; box-shadow: none; }

/* Launcher */
.mlqb-launch {
  display: inline-flex; align-items: center; gap: 8px;
  height: 52px; padding: 0 20px 0 16px;
  border: 0; border-radius: 26px; cursor: pointer;
  background: var(--mlqb-brand); color: #fff;
  font-weight: 600; letter-spacing: .01em;
  box-shadow: 0 6px 20px rgba(11, 35, 50, .25);
  transition: transform .15s ease, box-shadow .15s ease;
}
.mlqb-launch:hover { transform: translateY(-1px); box-shadow: 0 8px 24px rgba(11, 35, 50, .3); }
.mlqb-launch:focus-visible, .mlqb button:focus-visible, .mlqb a:focus-visible { outline: 3px solid color-mix(in srgb, var(--mlqb-brand) 45%, transparent); outline-offset: 2px; }
.mlqb-open .mlqb-launch { width: 52px; padding: 0; justify-content: center; }
.mlqb-open .mlqb-launch-label { display: none; }

/* Panel */
.mlqb-panel {
  width: 370px; max-width: calc(100vw - 32px);
  height: 580px; max-height: calc(100vh - var(--mlqb-offset) - 90px);
  display: flex; flex-direction: column;
  background: var(--mlqb-bg);
  border: 1px solid var(--mlqb-line);
  border-radius: 16px; overflow: hidden;
  box-shadow: 0 18px 48px rgba(11, 35, 50, .22);
  animation: mlqb-in .18s ease-out;
}
.mlqb-panel[hidden] { display: none; }
@keyframes mlqb-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.mlqb-head {
  display: flex; align-items: center; gap: 4px;
  padding: 14px 10px 14px 18px;
  background: var(--mlqb-brand); color: #fff;
}
.mlqb-head-text { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.mlqb-head-text strong { font-size: 16px; }
.mlqb-head-text span { font-size: 12.5px; opacity: .8; }
.mlqb-icon {
  width: 36px; height: 36px; border: 0; border-radius: 8px;
  background: transparent; color: #fff; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.mlqb-icon svg { width: 19px; height: 19px; }
.mlqb-icon:hover { background: rgba(255, 255, 255, .14); }

/* Messages */
.mlqb-log {
  flex: 1; overflow-y: auto; padding: 16px 14px 8px;
  display: flex; flex-direction: column; gap: 8px;
  background: var(--mlqb-soft);
  overscroll-behavior: contain;
}
.mlqb-msg { max-width: 86%; padding: 9px 13px; border-radius: 14px; white-space: pre-wrap; word-wrap: break-word; }
.mlqb-bot { align-self: flex-start; background: var(--mlqb-bg); border: 1px solid var(--mlqb-line); border-bottom-left-radius: 4px; }
.mlqb-me { align-self: flex-end; background: var(--mlqb-brand); color: #fff; border-bottom-right-radius: 4px; }
.mlqb-ok { background: var(--mlqb-ok); border-color: #b9e0cb; }
.mlqb-warn { background: var(--mlqb-warn); border-color: #f0cfae; }
.mlqb-typing { display: inline-flex; gap: 4px; padding: 13px 14px; }
.mlqb-typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--mlqb-muted); opacity: .4; animation: mlqb-dot 1s infinite; }
.mlqb-typing i:nth-child(2) { animation-delay: .15s; }
.mlqb-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes mlqb-dot { 50% { opacity: 1; transform: translateY(-2px); } }

.mlqb-summary {
  align-self: stretch; margin: 2px 0; padding: 12px 14px;
  background: var(--mlqb-bg); border: 1px solid var(--mlqb-line); border-radius: 12px;
  display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; font-size: 14px;
}
.mlqb-summary dt { color: var(--mlqb-muted); margin: 0; }
.mlqb-summary dd { margin: 0; font-weight: 500; word-break: break-word; }

/* Input dock */
.mlqb-dock { padding: 10px 12px 12px; background: var(--mlqb-bg); border-top: 1px solid var(--mlqb-line); max-height: 60%; overflow-y: auto; }
.mlqb-dock:empty { display: none; }
.mlqb-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.mlqb-chips + .mlqb-line { margin-top: 10px; }
.mlqb-chip {
  min-height: 38px; padding: 7px 14px;
  border: 1.5px solid var(--mlqb-brand); border-radius: 19px;
  background: var(--mlqb-bg); color: var(--mlqb-brand);
  font-weight: 500; cursor: pointer; text-decoration: none; line-height: 1.3;
  display: inline-flex; align-items: center;
}
.mlqb-chip:hover { background: var(--mlqb-brand); color: #fff; }
.mlqb-chip-ghost { border-color: var(--mlqb-line); color: var(--mlqb-muted); }
.mlqb-chip-ghost:hover { background: var(--mlqb-soft); color: var(--mlqb-ink); }
.mlqb-link { text-decoration: none !important; }
.mlqb-inline-link { flex-basis: 100%; margin-top: 4px; color: var(--mlqb-brand); font-size: 14px; }

.mlqb-line { display: flex; gap: 8px; align-items: flex-start; flex-wrap: wrap; }
.mlqb-line .mlqb-input { flex: 1; min-width: 0; }
.mlqb-date-lab { flex-basis: 100%; font-size: 13px; color: var(--mlqb-muted); }
.mlqb-input {
  width: 100%; min-height: 42px; padding: 9px 12px;
  border: 1.5px solid var(--mlqb-line); border-radius: 10px;
  background: var(--mlqb-bg); outline: none;
}
textarea.mlqb-input { min-height: 64px; resize: vertical; }
.mlqb-input:focus { border-color: var(--mlqb-brand); }
.mlqb-input.mlqb-bad { border-color: #c0392b; }
.mlqb-err { flex-basis: 100%; order: 3; color: #b03224; font-size: 13px; margin-top: 2px; }
.mlqb-send {
  width: 42px; height: 42px; flex: none; border: 0; border-radius: 10px;
  background: var(--mlqb-brand); color: #fff; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.mlqb-send svg { width: 20px; height: 20px; }

.mlqb-form { display: flex; flex-direction: column; gap: 9px; }
.mlqb-field { display: flex; flex-direction: column; gap: 3px; font-size: 13px; color: var(--mlqb-muted); margin: 0; }
.mlqb-field .mlqb-input { color: var(--mlqb-ink); font-size: 15px; }
.mlqb-field .mlqb-err { order: 0; }
.mlqb-primary {
  min-height: 44px; padding: 10px 18px; border: 0; border-radius: 10px;
  background: var(--mlqb-brand); color: #fff; font-weight: 600; cursor: pointer;
}
.mlqb-primary:disabled { opacity: .6; cursor: progress; }
.mlqb-actions { display: flex; gap: 8px; align-items: center; }
.mlqb-actions .mlqb-primary { flex: 1; }
.mlqb-hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; opacity: 0; }

/* Phones: full-width sheet */
@media (max-width: 480px) {
  .mlqb { right: 12px; bottom: calc(var(--mlqb-offset) * .75); }
  .mlqb[data-pos="left"] { left: 12px; }
  .mlqb-launch { height: 48px; }
  .mlqb.mlqb-open { left: 0; right: 0; bottom: 0; align-items: stretch; gap: 0; }
  .mlqb.mlqb-open .mlqb-launch { display: none; }
  .mlqb-panel { width: 100%; max-width: none; height: 100dvh; max-height: 100dvh; border-radius: 0; border: 0; }
  .mlqb-input { font-size: 16px; } /* stops iOS zooming in */
}

@media (prefers-reduced-motion: reduce) {
  .mlqb-panel, .mlqb-typing i { animation: none; }
  .mlqb-launch { transition: none; }
}
