.nwl-chat {
  --nwl-primary: #0759a5;
  --nwl-primary-dark: #073b70;
  --nwl-primary-pale: #eef5fc;
  --nwl-ink: #252a31;
  --nwl-muted: #747b85;
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 99990;
  color: var(--nwl-ink);
  font-family: Arial, sans-serif;
}

.nwl-chat [hidden] { display: none !important; }

.nwl-chat__launcher {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  border: 0;
  border-radius: 28px;
  padding: 14px 21px;
  position: relative;
  background: linear-gradient(135deg, var(--nwl-primary), var(--nwl-primary-dark));
  color: #fff;
  box-shadow: 0 8px 24px #0759a53d;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease;
}

.nwl-chat__launcher:hover { transform: translateY(-2px); box-shadow: 0 11px 28px #0759a54d; }
.nwl-chat__launcher span:first-child { font-size: 19px; }
.nwl-chat__badge { position: absolute; top: -8px; right: -8px; display: grid; min-width: 24px; height: 24px; place-items: center; padding: 0 5px; border: 2px solid #fff; border-radius: 20px; background: #d12c3e; color: #fff; box-shadow: 0 2px 8px #182e4640; font-size: 11px; font-weight: 700; animation: nwl-chat-pulse 1.8s ease-out infinite; }
@keyframes nwl-chat-pulse { 0%, 100% { box-shadow: 0 2px 8px #182e4640, 0 0 0 0 #d12c3e44; } 55% { box-shadow: 0 2px 8px #182e4640, 0 0 0 7px #d12c3e00; } }

.nwl-chat__panel {
  position: absolute;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  width: min(390px, calc(100vw - 28px));
  height: min(600px, calc(100dvh - 40px));
  overflow: hidden;
  border: 1px solid #dce6ef;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 20px 55px #102c4a30;
}

.nwl-chat__head {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 17px 18px;
  background: linear-gradient(120deg, var(--nwl-primary), var(--nwl-primary-dark));
  color: #fff;
}

.nwl-chat__head strong,
.nwl-chat__head small { display: block; }
.nwl-chat__head strong { font-size: 16px; line-height: 1.3; }
.nwl-chat__head small { margin-top: 5px; color: #e5f1ff; font-size: 12px; line-height: 1.4; }
.nwl-chat__close { flex: 0 0 auto; width: 36px; height: 36px; border: 1px solid #ffffff55; border-radius: 50%; background: #ffffff16; color: #fff; font-size: 25px; line-height: 1; cursor: pointer; }

.nwl-chat__messages {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 17px 14px 10px;
  background: linear-gradient(180deg, #f8fbff, #fff 42%);
  scroll-behavior: smooth;
}

.nwl-chat__bubble {
  display: table;
  max-width: 88%;
  margin: 0 0 13px;
  padding: 11px 13px;
  border-radius: 15px 15px 15px 5px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.nwl-chat__bubble--bot { border: 1px solid #e0eaf4; background: #fff; box-shadow: 0 3px 10px #102c4a0a; }
.nwl-chat__bubble--user { margin-left: auto; border-radius: 15px 15px 5px 15px; background: var(--nwl-primary); color: #fff; }
.nwl-chat__bubble-label { display: block; margin-bottom: 3px; color: var(--nwl-primary-dark); font-size: 11px; font-weight: 700; letter-spacing: .02em; }
.nwl-chat__bubble--user .nwl-chat__bubble-label { color: #dcecff; }
.nwl-chat__bubble-text:empty { display: none; }
.nwl-chat__attachment { display: flex; align-items: center; gap: 8px; max-width: 100%; margin-top: 7px; padding: 9px 10px; border: 1px solid #d9e6f3; border-radius: 10px; background: #f6faff; color: var(--nwl-primary-dark); text-decoration: none; font-size: 13px; overflow-wrap: anywhere; }
.nwl-chat__bubble--user .nwl-chat__attachment { border-color: #ffffff55; background: #ffffff16; color: #fff; }
.nwl-chat__attachment-icon { flex: 0 0 auto; font-size: 18px; }
.nwl-chat__attachment-meta { display: block; margin-top: 2px; opacity: .75; font-size: 11px; }
.nwl-chat__products { display: grid; gap: 7px; }
.nwl-chat__products a { display: flex; align-items: center; gap: 10px; padding: 8px; border: 1px solid #e0eaf4; border-radius: 10px; background: #fff; color: var(--nwl-primary-dark); text-decoration: none; font-size: 13px; }
.nwl-chat__products img { width: 48px; height: 48px; object-fit: contain; }

.nwl-chat__composer { display: flex; flex: 0 0 auto; align-items: center; gap: 7px; padding: 11px 12px 9px; border-top: 1px solid #f0e7e9; background: #fff; }
.nwl-chat__composer input,
.nwl-chat__handoff input:not([type="checkbox"]) { min-width: 0; width: 100%; border: 1px solid #ded6d8; border-radius: 10px; padding: 12px; outline: none; background: #fff; color: var(--nwl-ink); font: inherit; font-size: 14px; transition: border-color .15s ease, box-shadow .15s ease; }
.nwl-chat__composer input:focus,
.nwl-chat__handoff input:not([type="checkbox"]):focus { border-color: var(--nwl-primary); box-shadow: 0 0 0 3px #0759a51a; }
.nwl-chat__composer button,
.nwl-chat__handoff button[type="submit"] { flex: 0 0 auto; border: 0; border-radius: 10px; padding: 0 15px; background: var(--nwl-primary); color: #fff; font-size: 14px; font-weight: 700; cursor: pointer; transition: background .15s ease, transform .15s ease; }
.nwl-chat__composer button:hover,
.nwl-chat__handoff button[type="submit"]:hover { background: var(--nwl-primary-dark); }
.nwl-chat__composer button:disabled { opacity: .6; cursor: wait; }
.nwl-chat__composer .nwl-chat__attach { display: inline-flex; flex: 0 0 auto; align-items: center; justify-content: center; gap: 5px; min-width: 68px; height: 42px; padding: 0 9px; border: 1px solid #d8e4f1; background: #f5f9fe; color: var(--nwl-primary-dark); font-size: 12px; font-weight: 700; }
.nwl-chat__composer .nwl-chat__attach:hover { background: #eaf3fc; }
.nwl-chat__composer .nwl-chat__attach:focus-visible { outline: 3px solid #0759a544; outline-offset: 2px; }
.nwl-chat__attach svg { display: block; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.nwl-chat__attach-label { line-height: 1; }
.nwl-chat__selected-file { display: flex; flex: 0 1 138px; flex-direction: column; justify-content: center; gap: 4px; position: relative; min-width: 0; height: auto; min-height: 40px; padding: 7px 8px; border: 1px solid #b8d2ec; border-radius: 9px; background: #eef6ff; color: var(--nwl-primary-dark); }
.nwl-chat__selected-file-list { display: grid; gap: 3px; min-width: 0; }
.nwl-chat__selected-file-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.nwl-chat__selected-file-name { flex: 1 1 auto; min-width: 0; overflow: hidden; color: var(--nwl-primary-dark); font-size: 11px; font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
.nwl-chat__selected-file-state { overflow: hidden; color: var(--nwl-muted); font-size: 10px; line-height: 1.2; text-overflow: ellipsis; white-space: nowrap; }
.nwl-chat__composer .nwl-chat__selected-file-remove { display: grid; flex: 0 0 26px; width: 26px; height: 26px; place-items: center; padding: 0; border: 1px solid #c6d8e9; border-radius: 50%; background: #fff; color: var(--nwl-primary-dark); font-size: 19px; line-height: 1; }
.nwl-chat__selected-file-remove:disabled { cursor: wait; }
.nwl-chat__composer input:not([type="file"]) { flex: 1 1 auto; padding: 11px 10px; }
.nwl-chat__composer--has-file { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; }
.nwl-chat__composer--has-file .nwl-chat__attach { grid-column: 1; grid-row: 1; }
.nwl-chat__composer--has-file .nwl-chat__selected-file { grid-column: 1 / -1; grid-row: 2; width: 100%; height: auto; min-height: 42px; }
.nwl-chat__composer--has-file input:not([type="file"]) { grid-column: 1 / 3; grid-row: 3; width: 100%; }
.nwl-chat__composer--has-file button[type="submit"] { grid-column: 3; grid-row: 3; min-height: 42px; }

@media (max-width: 420px) {
  .nwl-chat__composer { gap: 5px; padding-right: 9px; padding-left: 9px; }
  .nwl-chat__composer .nwl-chat__attach { min-width: 62px; padding-right: 6px; padding-left: 6px; }
  .nwl-chat__composer--has-file { grid-template-columns: auto minmax(0, 1fr) auto; }
  .nwl-chat__selected-file { flex-basis: 90px; padding-right: 6px; padding-left: 6px; }
  .nwl-chat__composer button[type="submit"] { padding-right: 9px; padding-left: 9px; font-size: 12px; }
}

.nwl-chat__notice { display: block; flex: 0 0 auto; padding: 0 14px 8px; color: var(--nwl-muted); font-size: 11px; line-height: 1.45; }
.nwl-chat__notice a,
.nwl-chat__consent a { color: var(--nwl-primary-dark); }
.nwl-chat__handoff-open { align-self: flex-start; flex: 0 0 auto; margin: 0 14px 13px; padding: 3px 0; border: 0; background: transparent; color: var(--nwl-primary-dark); font-size: 13px; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.nwl-chat__status { flex: 0 0 auto; padding: 0 14px 11px; color: var(--nwl-muted); font-size: 12px; line-height: 1.4; }

.nwl-chat__handoff {
  display: grid;
  flex: 1 1 auto;
  align-content: center;
  gap: 12px;
  min-height: 0;
  overflow-y: auto;
  padding: 22px 20px;
  background: linear-gradient(180deg, #f6faff, #fff 55%);
}

.nwl-chat__handoff-heading { display: grid; gap: 5px; margin-bottom: 3px; }
.nwl-chat__handoff-heading strong { color: var(--nwl-primary-dark); font-size: 19px; }
.nwl-chat__handoff-heading small,
.nwl-chat__handoff > small { color: var(--nwl-muted); font-size: 12px; line-height: 1.45; }
.nwl-chat__consent { display: flex; align-items: flex-start; gap: 8px; color: #515962; font-size: 11px; line-height: 1.45; }
.nwl-chat__consent input { flex: 0 0 auto; width: 16px; height: 16px; margin: 1px 0 0; accent-color: var(--nwl-primary); }
.nwl-chat__handoff button[type="submit"] { min-height: 46px; }
.nwl-chat__handoff .nwl-chat__handoff-back { min-height: 40px; border: 1px solid #d8e4f1; background: #fff; color: var(--nwl-primary-dark); font-weight: 600; }
.nwl-chat__handoff .nwl-chat__handoff-back:hover { background: var(--nwl-primary-pale); }

.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; }

@media (max-width: 600px) {
  .nwl-chat { right: 12px; bottom: 12px; }
  .nwl-chat__launcher { padding: 12px 16px; }
  .nwl-chat__panel { width: calc(100vw - 24px); height: min(600px, calc(100dvh - 24px)); border-radius: 18px; }
  .nwl-chat__head { padding: 15px; }
  .nwl-chat__handoff { gap: 10px; padding: 18px 16px; }
}

@media (max-height: 520px) {
  .nwl-chat__panel { height: calc(100dvh - 16px); }
  .nwl-chat__handoff { align-content: start; }
}
