/* NeverMissed Support widget. Text-led, quiet borders, no chatbot caricature. */

.nmw {
  --nmw-gutter: 24px;
  font-family: var(--font-body, 'Source Sans 3', system-ui, sans-serif);
  color: var(--ink, #17353b);
}

.nmw [hidden] {
  display: none !important;
}

html.nmw-lock,
html.nmw-lock body {
  overflow: hidden;
}

/* Launcher */
.nmw-launcher {
  position: fixed;
  right: var(--nmw-gutter);
  bottom: var(--nmw-gutter);
  z-index: 2147483000;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 52px;
  padding: 0 20px 0 16px;
  border: 0;
  border-radius: 999px;
  background: var(--ink, #17353b);
  color: #fff;
  font: 600 17px/1 var(--font-body, system-ui);
  box-shadow: var(--shadow-panel);
  cursor: pointer;
}

.nmw-launcher:hover {
  background: var(--ink-hover, #0f2529);
}

/* Panel */
.nmw-panel {
  position: fixed;
  right: var(--nmw-gutter);
  bottom: var(--nmw-gutter);
  z-index: 2147483001;
  width: 392px;
  height: min(680px, calc(100vh - 2 * var(--nmw-gutter)));
  height: min(680px, calc(100dvh - 2 * var(--nmw-gutter)));
  display: flex;
  flex-direction: column;
  background: var(--surface, #fff);
  border: 1px solid var(--divider, #d8dede);
  border-radius: var(--radius-lg, 12px);
  box-shadow: var(--shadow-panel);
  overflow: hidden;
}

.nmw-head {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 16px 12px 12px 20px;
  border-bottom: 1px solid var(--divider, #d8dede);
}

.nmw-head__text {
  flex: 1;
  min-width: 0;
}

.nmw-title {
  margin: 0;
  font: 700 20px/1.3 var(--font-title, system-ui);
  letter-spacing: -0.01em;
  color: var(--ink, #17353b);
}

.nmw-disclosure {
  margin: 4px 0 0;
  font-size: 15px;
  line-height: 1.4;
  color: var(--text-2, #45565c);
}

.nmw-icon-btn {
  flex: none;
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: var(--radius, 10px);
  background: transparent;
  color: var(--ink, #17353b);
  cursor: pointer;
}

.nmw-icon-btn:hover {
  background: var(--visitor-tint, #eef1ef);
}

.nmw-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px 8px 20px;
  border-bottom: 1px solid var(--divider, #d8dede);
}

.nmw-person {
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--ink, #17353b);
  border-radius: var(--radius, 10px);
  background: var(--surface, #fff);
  color: var(--ink, #17353b);
  font: 600 16px/1 var(--font-body, system-ui);
  cursor: pointer;
}

.nmw-person:hover:not(:disabled) {
  background: var(--visitor-tint, #eef1ef);
}

.nmw-text-btn {
  min-height: 44px;
  padding: 0 8px;
  border: 0;
  background: transparent;
  color: var(--text-2, #45565c);
  font: 600 15px/1 var(--font-body, system-ui);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.nmw-text-btn:hover {
  color: var(--ink, #17353b);
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* Conversation log */
.nmw-log {
  flex: 1;
  overflow-y: auto;
  padding: 20px 20px 8px;
  overscroll-behavior: contain;
}

.nmw-log:focus-visible {
  outline-offset: -3px;
}

.nmw-msg {
  margin-bottom: 24px;
  font-size: 16px;
  line-height: 24px;
}

.nmw-msg--visitor {
  margin-left: 48px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.nmw-msg--visitor .nmw-msg__body {
  background: var(--visitor-tint, #eef1ef);
  border-radius: var(--radius-lg, 12px);
  padding: 8px 14px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.nmw-msg--visitor.is-pending .nmw-msg__body {
  color: var(--text-2, #45565c);
}

.nmw-msg__note {
  margin: 4px 0 0;
  font-size: 14px;
  color: var(--text-2, #45565c);
}

.nmw-msg__who {
  display: flex;
  gap: 8px;
  align-items: baseline;
  margin: 0 0 4px;
  font: 700 13px/1.4 var(--font-title, system-ui);
  color: var(--support, #234e66);
}

.nmw-msg__who time {
  font: 400 13px/1.4 var(--font-body, system-ui);
  color: var(--text-2, #45565c);
}

.nmw-msg__p {
  margin: 0 0 8px;
  overflow-wrap: anywhere;
}

.nmw-status {
  margin: 8px 0;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--support, #234e66);
}

.nmw-status--priority {
  color: var(--priority, #9a352d);
}

.nmw-status--complaint {
  color: var(--review, #7c510b);
}

.nmw-links {
  margin: 4px 0 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
}

.nmw-link {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  color: var(--support, #234e66);
  font-weight: 600;
  text-underline-offset: 3px;
}

/* Source line directly beneath the answer */
.nmw-source {
  margin-top: 4px;
}

.nmw-source__line {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  column-gap: 6px;
  font-size: 15px;
  line-height: 22px;
  color: var(--text-2, #45565c);
}

.nmw-source__link {
  color: var(--ink, #17353b);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  min-height: 32px;
  display: inline-flex;
  align-items: center;
}

.nmw-source__toggle {
  min-height: 32px;
  padding: 0 4px;
  border: 0;
  background: transparent;
  color: var(--support, #234e66);
  font: 600 14px/1 var(--font-body, system-ui);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.nmw-source__passage {
  margin: 8px 0 4px;
  padding: 12px 14px;
  background: var(--bg, #f7f6f2);
  border: 1px solid var(--divider, #d8dede);
  border-radius: var(--radius, 10px);
  font-size: 15px;
  line-height: 22px;
}

.nmw-source__passage blockquote {
  margin: 0;
}

.nmw-source__passage blockquote + blockquote {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--divider, #d8dede);
}

.nmw-source__passage p {
  margin: 0 0 6px;
}

.nmw-source__passage footer {
  font-size: 13px;
  color: var(--text-2, #45565c);
}

/* Support resources */
.nmw-resources-wrap {
  margin: 0 0 12px;
}

.nmw-resources {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--divider, #d8dede);
  border-radius: var(--radius, 10px);
}

.nmw-resources li {
  padding: 10px 14px;
  display: grid;
  gap: 2px;
}

.nmw-resources li + li {
  border-top: 1px solid var(--divider, #d8dede);
}

.nmw-resources__name {
  font-weight: 600;
}

.nmw-resources__detail {
  font-size: 15px;
  color: var(--text-2, #45565c);
}

.nmw-resources__detail a {
  color: var(--ink, #17353b);
  font-weight: 600;
}

.nmw-resources__note {
  margin: 6px 0 0;
  font-size: 13px;
  line-height: 1.4;
  color: var(--text-2, #45565c);
}

/* Offer */
.nmw-offer {
  margin-top: 8px;
}

.nmw-offer__btn {
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--divider-strong, #b9c4c2);
  border-radius: var(--radius, 10px);
  background: var(--surface, #fff);
  color: var(--ink, #17353b);
  font: 600 15px/1.2 var(--font-body, system-ui);
  cursor: pointer;
  text-align: left;
}

.nmw-offer__btn:hover {
  border-color: var(--ink, #17353b);
}

/* Handover preview */
.nmw-handover {
  margin: -8px 0 24px;
  padding: 14px 16px;
  border: 1px solid var(--divider-strong, #b9c4c2);
  border-radius: var(--radius-lg, 12px);
  background: var(--bg, #f7f6f2);
  font-size: 15px;
  line-height: 22px;
}

.nmw-handover__title {
  margin: 0;
  font: 700 15px/1.4 var(--font-title, system-ui);
}

.nmw-handover__state {
  margin: 2px 0 10px;
  color: var(--text-2, #45565c);
}

.nmw-handover__state strong {
  color: var(--ink, #17353b);
  letter-spacing: 0.02em;
}

.nmw-handover__facts {
  margin: 0 0 8px;
  display: grid;
  gap: 4px;
}

.nmw-handover__facts > div {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 8px;
}

.nmw-handover__facts dt {
  color: var(--text-2, #45565c);
}

.nmw-handover__facts dd {
  margin: 0;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.nmw-sev--priority {
  color: var(--priority, #9a352d);
}

.nmw-sev--review {
  color: var(--review, #7c510b);
}

.nmw-contact {
  margin: 4px 0 8px;
}

.nmw-contact summary {
  min-height: 40px;
  display: flex;
  align-items: center;
  cursor: pointer;
  font-weight: 600;
  color: var(--support, #234e66);
}

.nmw-contact__purpose {
  margin: 0 0 8px;
  color: var(--text-2, #45565c);
}

.nmw-contact__form {
  display: grid;
  gap: 4px;
}

.nmw-contact__form label {
  font-weight: 600;
  margin-top: 4px;
}

.nmw-contact__form input {
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--divider-strong, #b9c4c2);
  border-radius: var(--radius, 10px);
  font: 16px var(--font-body, system-ui);
  color: var(--ink, #17353b);
  background: var(--surface, #fff);
}

.nmw-contact__save {
  margin-top: 8px;
  justify-self: start;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--ink, #17353b);
  border-radius: var(--radius, 10px);
  background: var(--surface, #fff);
  color: var(--ink, #17353b);
  font: 600 15px/1 var(--font-body, system-ui);
  cursor: pointer;
}

.nmw-contact__saved {
  margin: 4px 0 0;
  min-height: 22px;
  color: var(--text-2, #45565c);
}

.nmw-handover__link {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  color: var(--support, #234e66);
  font-weight: 600;
  text-underline-offset: 3px;
}

/* Typing / loading, in context */
.nmw-typing {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px 12px;
  font-size: 15px;
  color: var(--text-2, #45565c);
}

.nmw-typing__dots {
  display: inline-flex;
  gap: 4px;
}

.nmw-typing__dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--support, #234e66);
  opacity: 0.35;
  animation: nmw-pulse 1.2s ease-in-out infinite;
}

.nmw-typing__dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.nmw-typing__dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes nmw-pulse {
  0%,
  80%,
  100% {
    opacity: 0.35;
  }
  40% {
    opacity: 1;
  }
}

/* Example prompts */
.nmw-chips {
  padding: 0 20px 12px;
}

.nmw-chips__label {
  margin: 0 0 8px;
  font-size: 14px;
  color: var(--text-2, #45565c);
}

.nmw-chips__list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.nmw-chip {
  min-height: 44px;
  padding: 6px 14px;
  border: 1px solid var(--divider-strong, #b9c4c2);
  border-radius: var(--radius, 10px);
  background: var(--surface, #fff);
  color: var(--ink, #17353b);
  font: 15px/1.3 var(--font-body, system-ui);
  text-align: left;
  cursor: pointer;
}

.nmw-chip:hover {
  border-color: var(--ink, #17353b);
}

/* Error with retry */
.nmw-error {
  margin: 0 20px 12px;
  padding: 10px 12px 10px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--priority, #9a352d);
  border-radius: var(--radius, 10px);
  background: var(--priority-tint, #f8ecea);
}

.nmw-error__text {
  margin: 0;
  flex: 1;
  font-size: 15px;
  line-height: 1.4;
  color: var(--ink, #17353b);
}

.nmw-retry {
  flex: none;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--ink, #17353b);
  border-radius: var(--radius, 10px);
  background: var(--surface, #fff);
  color: var(--ink, #17353b);
  font: 600 15px/1 var(--font-body, system-ui);
  cursor: pointer;
}

/* Composer */
.nmw-form {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px 12px 8px 20px;
  border-top: 1px solid var(--divider, #d8dede);
}

.nmw-input {
  flex: 1;
  min-height: 44px;
  max-height: 120px;
  padding: 10px 12px;
  border: 1px solid var(--divider-strong, #b9c4c2);
  border-radius: var(--radius, 10px);
  font: 16px/22px var(--font-body, system-ui);
  color: var(--ink, #17353b);
  background: var(--surface, #fff);
  resize: none;
}

.nmw-input::placeholder {
  color: #6a7a7f;
}

.nmw-input:focus-visible {
  outline: 3px solid var(--focus, #234e66);
  outline-offset: 0;
  border-color: var(--focus, #234e66);
}

.nmw-send {
  flex: none;
  min-width: 44px;
  height: 44px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  border-radius: var(--radius, 10px);
  background: var(--ink, #17353b);
  color: #fff;
  font: 600 16px/1 var(--font-body, system-ui);
  cursor: pointer;
}

.nmw-send:hover:not(:disabled) {
  background: var(--ink-hover, #0f2529);
}

.nmw-foot {
  margin: 0;
  padding: 0 20px 12px;
  font-size: 13px;
  color: var(--text-2, #45565c);
}

/* Mobile: accessible full-height sheet */
@media (max-width: 600px) {
  .nmw {
    --nmw-gutter: 16px;
  }
  .nmw-panel {
    inset: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    border: 0;
    border-radius: 0;
  }
  .nmw-head {
    padding: 12px 8px 10px 16px;
  }
  .nmw-bar {
    padding: 6px 8px 6px 16px;
  }
  .nmw-log {
    padding: 16px 16px 8px;
  }
  .nmw-msg--visitor {
    margin-left: 32px;
  }
  .nmw-chips,
  .nmw-typing,
  .nmw-foot {
    padding-left: 16px;
    padding-right: 16px;
  }
  .nmw-error {
    margin-left: 16px;
    margin-right: 16px;
  }
  .nmw-form {
    padding: 10px 8px calc(8px + env(safe-area-inset-bottom)) 16px;
  }
  .nmw-send__label {
    display: none;
  }
}
