/* Live Support chat widget (support-chat.js), shared by the site and the dashboard.
   Own tokens (--nrc-*) so it looks the same on both; NextRole teal + the
   product's purple for anything the AI assistant says. Classes are nrc-*. */
.nrc-root {
  --nrc-bg: #f5f7f6; --nrc-surface: #fff; --nrc-sunken: #eef2f0; --nrc-ink: #13201c; --nrc-ink2: #33433e; --nrc-muted: #5a6b65;
  --nrc-line: #dfe6e3; --nrc-line2: #c9d3cf; --nrc-accent: #0f7a64; --nrc-accent-hover: #0b6653; --nrc-accent-soft: #dff1eb;
  --nrc-ai: #6d28d9; --nrc-ai-soft: #ede9fe; --nrc-warn: #7a3d06; --nrc-warn-soft: #fef3c7; --nrc-crit: #b91c1c; --nrc-crit-soft: #fee2e2;
  --nrc-info-soft: #dbeafe; --nrc-shadow: 0 12px 40px rgba(19, 32, 28, .18);
  --nrc-bottom: 16px;
  font-family: 'Plus Jakarta Sans', 'Jakarta', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color: var(--nrc-ink);
}
/* Dark: follows the device, unless the page forces a theme (data-theme on <html>, like the site and dashboard). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .nrc-root {
    --nrc-bg: #0f1614; --nrc-surface: #16201d; --nrc-sunken: #1c2824; --nrc-ink: #e8efec; --nrc-ink2: #c4d0cb; --nrc-muted: #93a59e;
    --nrc-line: #26332f; --nrc-line2: #34443f; --nrc-accent: #1f9a80; --nrc-accent-hover: #24ad90; --nrc-accent-soft: #143a31;
    --nrc-ai: #b49cf5; --nrc-ai-soft: #2a2140; --nrc-warn: #f3c77a; --nrc-warn-soft: #3a2c12; --nrc-crit: #f19999; --nrc-crit-soft: #3d1b1b;
    --nrc-info-soft: #18263f; --nrc-shadow: 0 12px 40px rgba(0, 0, 0, .5);
  }
}
:root[data-theme="dark"] .nrc-root {
    --nrc-bg: #0f1614; --nrc-surface: #16201d; --nrc-sunken: #1c2824; --nrc-ink: #e8efec; --nrc-ink2: #c4d0cb; --nrc-muted: #93a59e;
    --nrc-line: #26332f; --nrc-line2: #34443f; --nrc-accent: #1f9a80; --nrc-accent-hover: #24ad90; --nrc-accent-soft: #143a31;
    --nrc-ai: #b49cf5; --nrc-ai-soft: #2a2140; --nrc-warn: #f3c77a; --nrc-warn-soft: #3a2c12; --nrc-crit: #f19999; --nrc-crit-soft: #3d1b1b;
    --nrc-info-soft: #18263f; --nrc-shadow: 0 12px 40px rgba(0, 0, 0, .5);
}
.nrc-root *, .nrc-root *::before, .nrc-root *::after { box-sizing: border-box; }
.nrc-root.in-app { --nrc-bottom: 16px; }
@media (max-width: 880px) { .nrc-root.in-app { --nrc-bottom: calc(64px + 12px); } }
.nrc-root button { font: inherit; cursor: pointer; }
.nrc-root [hidden] { display: none !important; }
.nrc-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Launcher */
.nrc-launch {
  position: fixed; right: 16px; bottom: calc(var(--nrc-bottom) + env(safe-area-inset-bottom, 0px)); z-index: 1200;
  width: 56px; height: 56px; border-radius: 28px; border: 0; background: var(--nrc-accent); color: #fff;
  display: flex; align-items: center; justify-content: center; box-shadow: var(--nrc-shadow);
}
.nrc-launch:hover { background: var(--nrc-accent-hover); }
.nrc-launch:focus-visible, .nrc-root :focus-visible { outline: 3px solid #f59e0b; outline-offset: 2px; }
.nrc-badge {
  position: absolute; top: -2px; right: -2px; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
  background: var(--nrc-crit); color: #fff; font-size: 12px; font-weight: 700; line-height: 20px; text-align: center;
}
.nrc-toast {
  position: fixed; right: 16px; bottom: calc(var(--nrc-bottom) + 68px + env(safe-area-inset-bottom, 0px)); z-index: 1200;
  max-width: min(320px, calc(100vw - 32px)); background: var(--nrc-surface); color: var(--nrc-ink); border: 1px solid var(--nrc-line);
  border-radius: 14px; padding: 12px 14px; box-shadow: var(--nrc-shadow); font-size: 14px; line-height: 1.45; text-align: left; border-left-width: 1px;
}
.nrc-toast b { display: block; margin-bottom: 2px; }

/* Panel */
.nrc-panel {
  position: fixed; right: 16px; bottom: calc(var(--nrc-bottom) + 68px + env(safe-area-inset-bottom, 0px)); z-index: 1201;
  width: 380px; height: min(640px, calc(100vh - var(--nrc-bottom) - 100px)); background: var(--nrc-bg);
  border: 1px solid var(--nrc-line); border-radius: 18px; box-shadow: var(--nrc-shadow); overflow: hidden;
  display: flex; flex-direction: column;
}
@media (max-width: 640px) {
  .nrc-panel { inset: 0; width: 100%; height: var(--nrc-vvh, 100dvh); border-radius: 0; border: 0; transform: translateY(var(--nrc-vvtop, 0px)); }
  html.nrc-lock, html.nrc-lock body { overflow: hidden !important; overscroll-behavior: none; }
}
@media (prefers-reduced-motion: no-preference) { .nrc-panel { animation: nrc-up .18s ease-out; } }
@keyframes nrc-up { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

.nrc-head {
  min-height: 60px; padding: 8px 6px 8px 14px; padding-top: max(8px, env(safe-area-inset-top, 0px));
  display: flex; align-items: center; gap: 10px; background: var(--nrc-surface); border-bottom: 1px solid var(--nrc-line); flex-shrink: 0;
}
.nrc-head img, .nrc-avatar { width: 34px; height: 34px; border-radius: 9px; flex-shrink: 0; }
.nrc-avatar { border-radius: 17px; background: var(--nrc-accent); color: #fff; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.nrc-title { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.nrc-title b { font-size: 15px; display: flex; align-items: center; gap: 6px; }
.nrc-title span { font-size: 12px; color: var(--nrc-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nrc-title .ok { color: #15803d; font-weight: 600; }
.nrc-title .wait { color: var(--nrc-warn); font-weight: 600; }
.nrc-chip { font-size: 10.5px; font-weight: 700; letter-spacing: .04em; color: var(--nrc-ai); background: var(--nrc-ai-soft); border-radius: 6px; padding: 2px 6px; }
.nrc-icon { width: 44px; height: 44px; border: 0; background: transparent; color: var(--nrc-ink2); border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.nrc-icon:hover { background: var(--nrc-sunken); }
.nrc-menu {
  position: absolute; right: 8px; top: 56px; z-index: 3; min-width: 220px; background: var(--nrc-surface); border: 1px solid var(--nrc-line);
  border-radius: 12px; box-shadow: var(--nrc-shadow); padding: 6px; display: flex; flex-direction: column;
}
.nrc-menu button { min-height: 44px; text-align: left; padding: 0 12px; border: 0; background: transparent; border-radius: 8px; color: var(--nrc-ink); font-size: 14px; }
.nrc-menu button:hover { background: var(--nrc-sunken); }

.nrc-strip { flex-shrink: 0; padding: 10px 14px; font-size: 13.5px; line-height: 1.45; display: flex; flex-direction: column; gap: 6px; border-bottom: 1px solid var(--nrc-line); }
.nrc-strip.warn { background: var(--nrc-warn-soft); color: var(--nrc-ink); }
.nrc-strip.info { background: var(--nrc-info-soft); }
.nrc-strip .row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.nrc-strip label { display: flex; align-items: center; gap: 8px; min-height: 40px; }
.nrc-strip input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--nrc-accent); }
.nrc-link { border: 0; background: transparent; color: var(--nrc-accent); font-weight: 700; padding: 0; min-height: 40px; text-decoration: underline; text-underline-offset: 2px; }

/* Body */
.nrc-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 14px 14px 6px; display: flex; flex-direction: column; gap: 10px; -webkit-overflow-scrolling: touch; }
.nrc-more { align-self: center; }
.nrc-day { align-self: center; font-size: 12px; color: var(--nrc-muted); }
.nrc-sys { align-self: center; max-width: 90%; text-align: center; font-size: 12px; color: var(--nrc-muted); background: var(--nrc-sunken); border-radius: 10px; padding: 4px 10px; }
.nrc-msg { max-width: 86%; display: flex; flex-direction: column; gap: 3px; content-visibility: auto; contain-intrinsic-size: auto 60px; }
.nrc-msg.them { align-self: flex-start; }
.nrc-msg.me { align-self: flex-end; align-items: flex-end; }
.nrc-who { font-size: 11px; font-weight: 700; color: var(--nrc-muted); }
.nrc-msg.bot .nrc-who { color: var(--nrc-ai); }
.nrc-msg.agent .nrc-who { color: var(--nrc-accent); }
.nrc-bubble { padding: 9px 13px; font-size: 15px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; border-radius: 4px 16px 16px 16px; background: var(--nrc-surface); border: 1px solid var(--nrc-line); }
.nrc-msg.me .nrc-bubble { border-radius: 16px 4px 16px 16px; background: var(--nrc-accent); color: #fff; border-color: var(--nrc-accent); }
.nrc-msg.me .nrc-bubble a { color: #fff; }
.nrc-msg.bot .nrc-bubble { background: var(--nrc-surface); }
.nrc-msg.failed .nrc-bubble { background: var(--nrc-crit-soft); color: var(--nrc-ink); border-color: var(--nrc-crit); }
.nrc-msg.sending .nrc-bubble { opacity: .65; }
.nrc-meta { font-size: 11px; color: var(--nrc-muted); display: flex; align-items: center; gap: 4px; }
.nrc-meta .read { color: var(--nrc-accent); }
.nrc-retry { border: 0; background: transparent; color: var(--nrc-crit); font-weight: 700; font-size: 12.5px; min-height: 36px; padding: 0 2px; }
.nrc-img { display: block; max-width: 220px; max-height: 220px; border-radius: 12px; border: 1px solid var(--nrc-line); cursor: zoom-in; background: var(--nrc-sunken); min-width: 80px; min-height: 60px; object-fit: cover; }
.nrc-file { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 6px 12px; border-radius: 10px; border: 1px solid var(--nrc-line2); background: var(--nrc-surface); color: var(--nrc-ink); font-size: 13.5px; text-decoration: none; }
.nrc-typing { align-self: flex-start; display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--nrc-muted); }
.nrc-dots { display: inline-flex; gap: 4px; background: var(--nrc-surface); border: 1px solid var(--nrc-line); border-radius: 14px; padding: 9px 12px; }
.nrc-dots i { width: 6px; height: 6px; border-radius: 3px; background: var(--nrc-muted); }
@media (prefers-reduced-motion: no-preference) {
  .nrc-dots i { animation: nrc-blink 1.2s infinite ease-in-out; }
  .nrc-dots i:nth-child(2) { animation-delay: .15s; } .nrc-dots i:nth-child(3) { animation-delay: .3s; }
}
@keyframes nrc-blink { 0%, 80%, 100% { opacity: .3; } 40% { opacity: 1; } }
.nrc-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.nrc-chips button { min-height: 40px; padding: 0 14px; border: 1px solid var(--nrc-line2); background: var(--nrc-surface); border-radius: 20px; color: var(--nrc-ink); font-size: 14px; }
.nrc-card { background: var(--nrc-surface); border: 1px solid var(--nrc-line); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.nrc-card .row { display: flex; gap: 8px; }
.nrc-card .row > button { flex: 1; }

/* Footer */
.nrc-foot { flex-shrink: 0; background: var(--nrc-surface); border-top: 1px solid var(--nrc-line); padding: 8px 10px; padding-bottom: max(10px, env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 8px; }
.nrc-human {
  align-self: center; min-height: 44px; padding: 0 18px; border: 1px solid var(--nrc-accent); background: var(--nrc-accent-soft); color: var(--nrc-accent-hover);
  border-radius: 22px; font-weight: 700; font-size: 14px; display: flex; align-items: center; gap: 8px;
}
.nrc-human.hot { background: var(--nrc-accent); color: #fff; }
.nrc-compose { display: flex; align-items: flex-end; gap: 6px; }
.nrc-compose textarea {
  flex: 1; min-height: 44px; max-height: 132px; padding: 11px 14px; border: 1px solid var(--nrc-line2); border-radius: 22px; background: var(--nrc-surface);
  color: var(--nrc-ink); font: inherit; font-size: 16px; line-height: 1.35; resize: none;
}
.nrc-send { width: 44px; height: 44px; border: 0; border-radius: 22px; background: var(--nrc-accent); color: #fff; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.nrc-send:disabled { opacity: .5; cursor: default; }
.nrc-attachments { display: flex; flex-wrap: wrap; gap: 6px; }
.nrc-attachments span { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; background: var(--nrc-sunken); border-radius: 8px; padding: 4px 4px 4px 10px; }
.nrc-attachments button { width: 32px; height: 32px; border: 0; background: transparent; color: var(--nrc-ink2); border-radius: 6px; }

/* Forms (start, recover, prefs) */
.nrc-form { flex: 1; overflow-y: auto; padding: 24px 18px 18px; display: flex; flex-direction: column; gap: 18px; }
.nrc-form h2 { margin: 0; font-size: 22px; line-height: 1.25; }
.nrc-form p { margin: 0; font-size: 14.5px; line-height: 1.55; color: var(--nrc-ink2); }
.nrc-form .box { background: var(--nrc-surface); border: 1px solid var(--nrc-line); border-radius: 16px; padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.nrc-form label.f { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; }
.nrc-form input[type=text], .nrc-form input[type=email] {
  height: 48px; padding: 0 14px; border: 1px solid var(--nrc-line2); border-radius: 10px; font: inherit; font-size: 16px; font-weight: 400; background: var(--nrc-surface); color: var(--nrc-ink);
}
.nrc-form .hint { font-size: 12.5px; line-height: 1.5; color: var(--nrc-muted); }
.nrc-form .err { font-size: 13.5px; color: var(--nrc-crit); font-weight: 600; }
.nrc-btn { min-height: 50px; border: 0; border-radius: 12px; background: var(--nrc-accent); color: #fff; font-weight: 700; font-size: 16px; padding: 0 18px; }
.nrc-btn:hover { background: var(--nrc-accent-hover); }
.nrc-btn:disabled { opacity: .6; }
.nrc-btn.ghost { background: var(--nrc-surface); color: var(--nrc-ink); border: 1px solid var(--nrc-line2); }
.nrc-hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.nrc-pref { display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 10px 14px; border-bottom: 1px solid var(--nrc-line); }
.nrc-pref:last-child { border-bottom: 0; }
.nrc-pref > span { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.nrc-pref b { font-size: 15px; }
.nrc-pref small { font-size: 13px; color: var(--nrc-muted); line-height: 1.4; }
.nrc-pref input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--nrc-accent); }
.nrc-prefs { background: var(--nrc-surface); border: 1px solid var(--nrc-line); border-radius: 14px; }
.nrc-note { display: flex; gap: 10px; background: var(--nrc-info-soft); border-radius: 12px; padding: 12px 14px; font-size: 13.5px; line-height: 1.5; }

/* Sheet (confirm "talk to a person") and image viewer */
.nrc-shade { position: absolute; inset: 0; background: rgba(19, 32, 28, .45); z-index: 4; display: flex; align-items: flex-end; }
.nrc-sheet { width: 100%; background: var(--nrc-surface); border-radius: 20px 20px 0 0; padding: 12px 18px 20px; padding-bottom: max(20px, env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 14px; }
.nrc-sheet .grab { align-self: center; width: 40px; height: 4px; border-radius: 2px; background: var(--nrc-line2); }
.nrc-sheet h3 { margin: 0; font-size: 19px; }
.nrc-sheet p { margin: 0; font-size: 14.5px; line-height: 1.55; color: var(--nrc-ink2); }
.nrc-viewer { position: fixed; inset: 0; z-index: 1300; background: rgba(0, 0, 0, .85); display: flex; align-items: center; justify-content: center; padding: 16px; }
.nrc-viewer img { max-width: 100%; max-height: 100%; border-radius: 8px; }
.nrc-viewer button { position: absolute; top: max(12px, env(safe-area-inset-top, 0px)); right: 12px; color: #fff; }
