/* Support chat. Appended to the built site.css by build.mjs.
   Dark surface, ice-blue accent to match the existing Vaultary palette
   (--blue #9bd8f3 on --canvas #101216). No new colours invented. */

.assist {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 60;
  font-family: var(--sans, system-ui, sans-serif);
}

.assist-launcher {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid var(--line, #353d48);
  border-radius: 999px;
  background: var(--plane, #181c22);
  color: var(--text, #f1f3f4);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  cursor: pointer;
  box-shadow: 0 10px 30px rgb(0 0 0 / 45%);
}

.assist-launcher:hover {
  border-color: var(--blue, #9bd8f3);
  color: var(--blue, #9bd8f3);
}

.assist-launcher:focus-visible,
.assist-send:focus-visible,
.assist-close:focus-visible,
.assist textarea:focus-visible {
  outline: 2px solid var(--blue, #9bd8f3);
  outline-offset: 2px;
}

.assist-panel {
  position: absolute;
  right: 0;
  bottom: 60px;
  width: min(380px, calc(100vw - 40px));
  max-height: min(560px, calc(100vh - 120px));
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line, #353d48);
  border-radius: 14px;
  background: var(--plane, #181c22);
  box-shadow: 0 24px 60px rgb(0 0 0 / 55%);
  overflow: hidden;
}

.assist-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line, #353d48);
}

.assist-head strong {
  display: block;
  font-size: 14px;
  letter-spacing: -0.01em;
}

.assist-head small {
  display: block;
  margin-top: 3px;
  color: var(--muted, #acb6c3);
  font-size: 11.5px;
  line-height: 1.35;
}

.assist-close {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted, #acb6c3);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.assist-close:hover {
  background: rgb(255 255 255 / 6%);
  color: var(--text, #f1f3f4);
}

.assist-log {
  flex: 1 1 auto;
  min-height: 120px;
  overflow-y: auto;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}

.assist-bubble {
  max-width: 92%;
  padding: 9px 12px;
  border-radius: 12px;
  font-size: 13.5px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.assist-assistant {
  align-self: flex-start;
  background: var(--deep, #090b0e);
  border: 1px solid var(--line, #353d48);
  color: var(--text, #f1f3f4);
}

.assist-user {
  align-self: flex-end;
  background: rgb(155 216 243 / 14%);
  border: 1px solid rgb(155 216 243 / 34%);
  color: var(--text, #f1f3f4);
}

.assist-bubble.is-pending {
  color: var(--muted, #acb6c3);
  font-style: italic;
}

.assist-warn {
  margin: 0;
  padding: 0 16px 10px;
  color: var(--muted, #acb6c3);
  font-size: 11px;
  line-height: 1.4;
}

.assist-form {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  padding: 12px 16px 16px;
  border-top: 1px solid var(--line, #353d48);
}

.assist textarea {
  flex: 1 1 auto;
  min-height: 42px;
  max-height: 140px;
  padding: 10px 12px;
  border: 1px solid var(--line, #353d48);
  border-radius: 10px;
  background: var(--deep, #090b0e);
  color: var(--text, #f1f3f4);
  font: inherit;
  font-size: 13.5px;
  line-height: 1.45;
  resize: none;
  overflow-y: auto;
  /* A one-line placeholder must never wrap and clip inside a 42px field. */
  white-space: nowrap;
}

.assist textarea::placeholder {
  color: var(--muted, #acb6c3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.assist-head strong {
  display: block;
  color: var(--text, #f1f3f4);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.assist-send {
  flex: 0 0 auto;
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid rgb(155 216 243 / 40%);
  border-radius: 10px;
  background: rgb(155 216 243 / 16%);
  color: var(--blue, #9bd8f3);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.assist-send:hover:not(:disabled) {
  background: rgb(155 216 243 / 26%);
}

.assist-send:disabled {
  opacity: 0.55;
  cursor: default;
}

.assist-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 520px) {
  .assist {
    right: 12px;
    bottom: 12px;
    left: 12px;
  }
  .assist-launcher {
    width: 100%;
    justify-content: center;
  }
  .assist-panel {
    right: 0;
    left: 0;
    width: auto;
    bottom: 58px;
    max-height: min(70vh, 520px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .assist-log {
    scroll-behavior: auto;
  }
}
