:root {
  --nw-ai-navy: #003d79;
  --nw-ai-blue: #004a8f;
  --nw-ai-red: #c8102e;
  --nw-ai-ink: #1a1a2e;
  --nw-ai-muted: #52657a;
  --nw-ai-border: #dce5ee;
  --nw-ai-surface: #f5f7fa;
  --nw-ai-white: #fff;
}

/* The `hidden` attribute is the disabled-state kill switch. A class rule that sets
   `display` outranks the UA `[hidden]{display:none}` rule (author beats UA), so the
   launcher must re-assert none for its own hidden state or it renders while off. */
.nw-ai-launcher[hidden],
.nw-ai[hidden] { display: none !important; }

.nw-ai-launcher {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 2147482000;
  min-height: 52px;
  padding: 0 19px;
  border: 0;
  border-radius: 999px;
  background: var(--nw-ai-navy);
  color: var(--nw-ai-white);
  box-shadow: 0 12px 32px rgba(0, 45, 89, .26);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font: 700 14px/1 "Plus Jakarta Sans", Arial, sans-serif;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}

.nw-ai-launcher:hover { background: var(--nw-ai-blue); transform: translateY(-2px); box-shadow: 0 16px 36px rgba(0, 45, 89, .3); }
.nw-ai-launcher:focus-visible, .nw-ai button:focus-visible, .nw-ai input:focus-visible, .nw-ai textarea:focus-visible, .nw-ai select:focus-visible { outline: 3px solid rgba(200, 16, 46, .34); outline-offset: 2px; }
.nw-ai-launcher svg { width: 21px; height: 21px; flex: 0 0 auto; }

.nw-ai {
  position: fixed;
  right: 22px;
  bottom: 86px;
  z-index: 2147482001;
  width: min(400px, calc(100vw - 28px));
  max-height: min(680px, calc(100vh - 112px));
  overflow: hidden;
  border: 1px solid var(--nw-ai-border);
  border-radius: 18px;
  background: var(--nw-ai-white);
  box-shadow: 0 24px 70px rgba(16, 38, 60, .24);
  color: var(--nw-ai-ink);
  display: none;
  font-family: Inter, Arial, sans-serif;
}

.nw-ai[data-open="true"] { display: flex; flex-direction: column; }
.nw-ai__header { background: var(--nw-ai-navy); color: #fff; padding: 18px 18px 16px; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.nw-ai__title { margin: 0; color: #fff; font: 800 18px/1.2 "Plus Jakarta Sans", Arial, sans-serif; letter-spacing: -.02em; }
.nw-ai__subtitle { margin: 5px 0 0; color: rgba(255,255,255,.82); font: 500 12px/1.45 Inter, Arial, sans-serif; }
.nw-ai__close { border: 0; background: transparent; color: #fff; width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; cursor: pointer; }
.nw-ai__close:hover { background: rgba(255,255,255,.12); }
.nw-ai__close svg { width: 20px; height: 20px; }

.nw-ai__body { padding: 16px; overflow: auto; overscroll-behavior: contain; }
.nw-ai__notice { margin: 0 0 14px; padding: 11px 12px; border-left: 3px solid var(--nw-ai-red); background: #fff5f6; color: #59313a; font-size: 12px; line-height: 1.5; }
.nw-ai__quick { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.nw-ai__quick button, .nw-ai__action, .nw-ai__secondary { min-height: 42px; border-radius: 9px; font: 700 12px/1.25 "Plus Jakarta Sans", Arial, sans-serif; cursor: pointer; }
.nw-ai__quick button { padding: 9px 10px; border: 1px solid var(--nw-ai-border); background: var(--nw-ai-white); color: var(--nw-ai-navy); text-align: left; }
.nw-ai__quick button:hover { border-color: #9eb6cd; background: var(--nw-ai-surface); }

.nw-ai__messages { display: grid; gap: 10px; }
.nw-ai__message { padding: 11px 12px; border-radius: 11px; font-size: 13px; line-height: 1.55; }
.nw-ai__message--assistant { background: var(--nw-ai-surface); color: var(--nw-ai-ink); }
.nw-ai__message--user { margin-left: 34px; background: var(--nw-ai-navy); color: #fff; }
.nw-ai__status { margin: 6px 0 0; color: var(--nw-ai-muted); font-size: 11px; line-height: 1.4; }
.nw-ai__card { border: 1px solid var(--nw-ai-border); border-radius: 11px; padding: 12px; background: #fff; }
.nw-ai__card h4 { margin: 0 0 6px; color: var(--nw-ai-ink); font: 800 14px/1.3 "Plus Jakarta Sans", Arial, sans-serif; }
.nw-ai__card p { margin: 0; color: #40566e; font-size: 12px; line-height: 1.55; }
.nw-ai__card a { display: inline-flex; margin-top: 9px; color: var(--nw-ai-navy); font: 700 12px/1.3 "Plus Jakarta Sans", Arial, sans-serif; text-decoration: underline; text-underline-offset: 3px; }
.nw-ai__actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.nw-ai__action, .nw-ai__secondary { padding: 9px 11px; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
.nw-ai__action { border: 1px solid var(--nw-ai-navy); background: var(--nw-ai-navy); color: #fff; }
.nw-ai__action:hover { background: var(--nw-ai-blue); }
.nw-ai__secondary { border: 1px solid var(--nw-ai-border); background: #fff; color: var(--nw-ai-navy); }

.nw-ai__composer { margin-top: 14px; border-top: 1px solid var(--nw-ai-border); padding-top: 12px; }
.nw-ai__composer label, .nw-ai__form label { display: block; margin-bottom: 5px; color: var(--nw-ai-ink); font: 700 11px/1.35 "Plus Jakarta Sans", Arial, sans-serif; }
.nw-ai__composer-row { display: flex; gap: 8px; align-items: flex-end; }
.nw-ai__composer textarea, .nw-ai__form input, .nw-ai__form textarea, .nw-ai__form select { width: 100%; border: 1px solid #b9c8d7; border-radius: 9px; background: #fff; color: var(--nw-ai-ink); padding: 10px 11px; font: 500 13px/1.45 Inter, Arial, sans-serif; }
.nw-ai__composer textarea { min-height: 44px; max-height: 100px; resize: vertical; }
.nw-ai__send { flex: 0 0 46px; width: 46px; height: 44px; border: 0; border-radius: 9px; background: var(--nw-ai-red); color: #fff; display: grid; place-items: center; cursor: pointer; }
.nw-ai__send:hover { background: #a90d26; }
.nw-ai__send svg { width: 19px; height: 19px; }
.nw-ai__counter { margin-top: 4px; text-align: right; color: var(--nw-ai-muted); font-size: 10px; }

.nw-ai__form { display: grid; gap: 10px; }
.nw-ai__form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.nw-ai__form textarea { min-height: 88px; resize: vertical; }
.nw-ai__form-actions { display: flex; gap: 8px; }
.nw-ai__review { padding: 12px; border: 1px solid var(--nw-ai-border); border-radius: 10px; background: var(--nw-ai-surface); font-size: 12px; line-height: 1.55; white-space: pre-wrap; }
.nw-ai__turnstile { min-height: 1px; }
.nw-ai__privacy { margin: 10px 0 0; color: var(--nw-ai-muted); font-size: 10px; line-height: 1.45; }
.nw-ai__sr { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0,0,0,0) !important; white-space: nowrap !important; border: 0 !important; }

@media (max-width: 520px) {
  .nw-ai-launcher { right: 14px; bottom: 14px; min-height: 50px; }
  .nw-ai { left: 7px; right: auto; bottom: 74px; width: calc(100% - 14px); max-height: calc(100dvh - 88px); border-radius: 15px; }
  .nw-ai__quick, .nw-ai__form-row { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .nw-ai-launcher { transition: none; }
}
