.nimble-mascot-trigger {
  appearance: none;
  display: inline-grid;
  place-items: center;
  flex: 0 0 48px;
  width: 48px;
  height: 48px;
  min-width: 48px;
  min-height: 48px;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 2px solid #fff6df;
  border-radius: 50%;
  background: #f1d9a8;
  box-shadow: 0 3px 0 #5b3b27, 0 4px 12px rgba(0, 0, 0, .28);
  color: #241a10;
  cursor: pointer;
  line-height: 1;
}

.nimble-mascot-trigger:hover,
.nimble-mascot-trigger:focus-visible {
  background: #ffe7b4;
  border-color: #fff;
  filter: brightness(1.06);
  outline: 3px solid rgba(241, 217, 168, .45);
  outline-offset: 2px;
}

.nimble-mascot-trigger:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #5b3b27, 0 2px 7px rgba(0, 0, 0, .25);
}

.nimble-mascot-trigger svg { display: block; width: 44px; height: 44px; }
body.nimble-ai-open { overflow: hidden; }
.nimble-ai-overlay[hidden] { display: none !important; }

.nimble-ai-overlay {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(18, 13, 22, .72);
  backdrop-filter: blur(4px);
  font-family: Arial, Helvetica, sans-serif;
  color: #2b2118;
}

.nimble-ai-dialog {
  display: grid;
  grid-template-rows: auto minmax(120px, 1fr) auto;
  width: min(680px, calc(100vw - 28px));
  max-height: min(760px, calc(100vh - 30px));
  overflow: hidden;
  border: 3px solid #8d6a47;
  border-radius: 22px;
  background: #fff8e7;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .48);
}

.nimble-ai-header {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) 42px;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  color: #fff;
  background: linear-gradient(135deg, #3a2946, #1e1727);
  border-bottom: 3px solid #b99561;
}

.nimble-ai-header svg { width: 50px; height: 50px; }
.nimble-ai-header h2 { margin: 0; color: #fff; font: 700 1.28rem Georgia, 'Times New Roman', serif; }
.nimble-ai-header p { margin: 4px 0 0; color: #f1d9a8; font-size: .82rem; line-height: 1.35; }
.nimble-ai-close {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  min-width: 40px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .35);
  border-radius: 50%;
  background: rgba(255, 255, 255, .1);
  box-shadow: none;
  color: #fff;
  font: 700 1.35rem/1 Arial, sans-serif;
  cursor: pointer;
}
.nimble-ai-close:hover { background: rgba(255, 255, 255, .22); }

.nimble-ai-answer {
  min-height: 190px;
  overflow: auto;
  padding: 18px;
  background: #fffdf6;
}
.nimble-ai-welcome { margin: 0; color: #584737; line-height: 1.55; }
.nimble-ai-answer-text { margin: 0; white-space: pre-wrap; line-height: 1.58; }
.nimble-ai-answer-text.is-loading { color: #6b5578; font-style: italic; }
.nimble-ai-answer-text.is-error { color: #8b211d; }
.nimble-ai-sources { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0 0; padding: 0; list-style: none; }
.nimble-ai-sources li { padding: 5px 9px; border: 1px solid #b49b73; border-radius: 999px; background: #f3e4bf; color: #574331; font-size: .78rem; }

.nimble-ai-form { display: grid; gap: 10px; padding: 14px 16px 16px; border-top: 1px solid #c9b590; background: #efe0bd; }
.nimble-ai-form label { color: #3b2b20; font-weight: 700; }
.nimble-ai-form textarea,
.nimble-ai-form select {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 2px solid #6e5a8f;
  border-radius: 11px;
  background: #fffdf6;
  color: #261b13;
  font: 1rem Arial, sans-serif;
}
.nimble-ai-form textarea { min-height: 92px; resize: vertical; }
.nimble-ai-controls { display: grid; grid-template-columns: minmax(150px, .8fr) auto; gap: 10px; align-items: center; }
.nimble-ai-submit {
  min-height: 46px;
  padding: 10px 18px;
  border: 0;
  border-radius: 12px;
  color: #fff;
  background: linear-gradient(#6d55b2, #3f357b);
  box-shadow: 0 3px 0 #211b4e;
  font-weight: 700;
  cursor: pointer;
}
.nimble-ai-submit:disabled { cursor: wait; opacity: .65; }
.nimble-ai-privacy { margin: 0; color: #6b5a47; font-size: .78rem; line-height: 1.4; }

@media (max-width: 620px) {
  .nimble-ai-overlay { place-items: end center; padding: 0; }
  .nimble-ai-dialog { width: 100%; max-height: 92vh; border-width: 2px 0 0; border-radius: 20px 20px 0 0; }
  .nimble-ai-header { grid-template-columns: 46px minmax(0, 1fr) 40px; padding: 11px 12px; }
  .nimble-ai-header svg { width: 44px; height: 44px; }
  .nimble-ai-answer { min-height: 150px; padding: 14px; }
  .nimble-ai-form { padding: 12px; }
  .nimble-ai-controls { grid-template-columns: 1fr; }
  .nimble-ai-submit { width: 100%; }
}

@media print {
  .nimble-mascot-trigger,
  .nimble-ai-overlay { display: none !important; }
}
