/*
 * MyIntelisys Assistant: shared tokens and the chat and sign-in pages.
 *
 * Colour, type and logo follow the Intelisys brand guide; component shape and behaviour follow Material Design 3
 * (filled, tonal, outlined and text buttons; 8 px chips; 12 px cards; outlined text fields; 3 px focus rings; M3
 * corner and elevation scales). Intelisys Red leads for actions and key indicators; the neutrals are Dark Node,
 * Graphite, Echo Grey, cool greys and White (no Vellum or other beige, MI-108). Buttons and inputs are rounded
 * rectangles in the chat, never pills or circles. Quantum Violet, Horizon Gold and ScanSource Orange are not used.
 *
 * Type: Gotham is the brand face, but the widget CSP allows no web font and no licensed files are self-hosted yet, so
 * the stacks use Arial, the brand's approved system fallback. Bold (700) for titles and headings, regular for body.
 * Every font-family ends in a generic family.
 *
 * Contrast (WCAG 2.1): white on Intelisys Red 5.2:1; --primary-text on white 6.8:1 and on the red tint 5.9:1;
 * --muted on white 6.4:1 and on the pale grey 6.0:1; --outline on white 3.5:1 (non-text). Dark: --primary-text on the dark
 * surface 7.4:1, --muted (Echo Grey) 5.9:1.
 *
 * Dark palette under prefers-color-scheme, guarded by :root:not([data-theme="light"]) and repeated for
 * [data-theme="dark"]. The chat page and the portal sign-in frame set data-theme="light" (MI-99: light only). The admin and sign-in header stays Dark Node in both themes; the chat header is light.
 */
:root {
  /* Brand */
  --red: #d71925; /* Intelisys Red */
  --dark-node: #000000;
  --graphite: #393938;
  --echo-grey: #999999;
  /* Roles (M3 names where they exist) */
  --primary: #d71925; /* fills that carry white text: 5.2:1 */
  --primary-hover: #b5121c; /* hover and pressed fills: 6.8:1 with white */
  --primary-text: #b5121c; /* red text on white and on the red tints: 5.9:1 or more */
  --on-primary: #ffffff;
  --accent-soft: #fbe9ea; /* primary container */
  --accent-line: #f2c1c4;
  --tonal: #f1f1f1; /* tonal buttons and selected chips */
  --tonal-hover: #e4e4e4;
  --bad: #b3261e;
  --ink: #393938;
  --ink2: #393938;
  --grey: #5f5f5e;
  --line: #e2e2e2;
  --pale: #f5f5f5;
  --bg: #ffffff;
  --card: #ffffff;
  --user: #f1f1f1;
  --positive: #1e7f4f;
  --hdr: #000000;
  --th: #393938;
  --canvas: #f7f7f7;
  --surface: #ffffff;
  --border: #e2e2e2;
  --outline: #8a8a89; /* field and outlined-button borders: 3.5:1 on white */
  --text: #000000;
  --muted: #5f5f5e;
  --link: #b5121c;
  --chip: #f1f1f1;
  --chip-strong: #e4e4e4;
  --focus: #d71925;
  --focus-ring: rgba(215, 25, 37, 0.16);
  --ok: #1e7f4f;
  --ok-soft: #eaf6ef;
  --ok-line: #c6e7d4;
  --warn: #9a5b00;
  --warn-soft: #fff4e2;
  --bad-soft: #fdecec;
  /* M3 elevation levels 1 to 3 */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3), 0 1px 3px 1px rgba(0, 0, 0, 0.15);
  --shadow-md: 0 1px 2px rgba(0, 0, 0, 0.3), 0 2px 6px 2px rgba(0, 0, 0, 0.15);
  --shadow-lg: 0 1px 3px rgba(0, 0, 0, 0.3), 0 4px 8px 3px rgba(0, 0, 0, 0.15);
  --shadow: var(--shadow-md);
  /* M3 corner scale */
  --r-xs: 4px;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 28px;
  --r-full: 999px;
  --font-head: Arial, "Helvetica Neue", Helvetica, sans-serif;
  --font-body: Arial, "Helvetica Neue", Helvetica, sans-serif;
  --font-mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121212;
    --card: #1e1e1d;
    --ink: #e8e6df;
    --ink2: #e8e6df;
    --grey: #999999;
    --line: #3a3a39;
    --pale: #262625;
    --user: #33312a;
    --positive: #46b983;
    --bad: #ff6b72;
    --hdr: #000000;
    --th: #393938;
    --primary-text: #ff8a8f;
    --accent-soft: #3b1a1c;
    --accent-line: #6e2228;
    --tonal: #33312a;
    --tonal-hover: #3f3c33;
    --canvas: #121212;
    --surface: #1e1e1d;
    --border: #353534;
    --outline: #8f8e8a;
    --text: #f1f1f1;
    --muted: #999999;
    --link: #ff8a8f;
    --chip: #2a2a29;
    --chip-strong: #343433;
    --focus: #ff8a8f;
    --focus-ring: rgba(255, 138, 143, 0.24);
    --ok: #46b983;
    --ok-soft: #173024;
    --ok-line: #24503a;
    --warn: #f0b35a;
    --warn-soft: #33270f;
    --bad-soft: #3a1c1e;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5), 0 1px 3px 1px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 1px 2px rgba(0, 0, 0, 0.5), 0 2px 6px 2px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 1px 3px rgba(0, 0, 0, 0.5), 0 4px 8px 3px rgba(0, 0, 0, 0.3);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #121212;
  --card: #1e1e1d;
  --ink: #e8e6df;
  --ink2: #e8e6df;
  --grey: #999999;
  --line: #3a3a39;
  --pale: #262625;
  --user: #33312a;
  --positive: #46b983;
  --bad: #ff6b72;
  --hdr: #000000;
  --th: #393938;
  --primary-text: #ff8a8f;
  --accent-soft: #3b1a1c;
  --accent-line: #6e2228;
  --tonal: #33312a;
  --tonal-hover: #3f3c33;
  --canvas: #121212;
  --surface: #1e1e1d;
  --border: #353534;
  --outline: #8f8e8a;
  --text: #f1f1f1;
  --muted: #999999;
  --link: #ff8a8f;
  --chip: #2a2a29;
  --chip-strong: #343433;
  --focus: #ff8a8f;
  --focus-ring: rgba(255, 138, 143, 0.24);
  --ok: #46b983;
  --ok-soft: #173024;
  --ok-line: #24503a;
  --warn: #f0b35a;
  --warn-soft: #33270f;
  --bad-soft: #3a1c1e;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5), 0 1px 3px 1px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 1px 2px rgba(0, 0, 0, 0.5), 0 2px 6px 2px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 1px 3px rgba(0, 0, 0, 0.5), 0 4px 8px 3px rgba(0, 0, 0, 0.3);
  color-scheme: dark;
}

/* ------------------------------------------------------------------------------------------ base */

[hidden] {
  display: none !important;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.55 var(--font-body);
}

select,
button,
input,
textarea {
  font: inherit;
}

/* Native checkboxes, radios and sliders take the brand red instead of the browser blue. */
input[type="checkbox"],
input[type="radio"],
input[type="range"] {
  accent-color: var(--primary);
}

/* M3 focus indicator: a 3 px ring 2 px outside the control. */
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

a {
  color: var(--link);
  text-underline-offset: 2px;
}

.nojs {
  margin: 16px;
  padding: 12px 14px;
  border: 1px solid var(--primary);
  border-radius: var(--r-md);
  background: var(--user);
}

.clip {
  position: fixed;
  left: -9999px;
  top: 0;
  opacity: 0;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

/* ------------------------------------------------------------------------------------------ header */

header {
  background: var(--hdr);
  color: #ffffff;
  border-bottom: 4px solid var(--primary);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.brand {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 19px;
  letter-spacing: 0;
}

/* Intelisys Red on Dark Node: 4.1:1, large bold text (19 px, 700), so it passes AA. */
.brand span {
  color: var(--primary);
  font-weight: 700;
}

.spacer {
  flex: 1;
}

.ctl {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 12px;
  color: #dddddd;
  cursor: pointer;
}

.ctl select {
  background: #393938;
  color: #ffffff;
  border: 1px solid #999999;
  border-radius: var(--r-xs);
  padding: 5px 8px;
  max-width: 240px;
}

a.adm,
a.hlink {
  color: #ffffff;
  opacity: 0.85;
  font-size: 12px;
  text-decoration: none;
  border: 1px solid #999999;
  padding: 5px 12px;
  border-radius: var(--r-full);
  font-weight: 700;
}

a.adm:hover,
a.hlink:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.08);
  border-color: #ffffff;
}

.disg {
  font-size: 11px;
  background: var(--primary);
  color: #ffffff;
  border-radius: var(--r-full);
  padding: 2px 8px;
  font-weight: 700;
}

.who {
  font-size: 12px;
  color: #cccccc;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.who:empty {
  display: none;
}

button.out {
  background: transparent;
  color: #ffffff;
  border: 1px solid #999999;
  border-radius: var(--r-full);
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  opacity: 0.85;
}

button.out:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.08);
  border-color: #ffffff;
}

/* ------------------------------------------------------------------------------------------ shared controls */

footer {
  border-top: 1px solid var(--line);
  padding: 10px 16px 14px;
  background: var(--bg);
  position: relative;
}

/* Filled button: a rounded rectangle, 40 px, bold label (Arial has no medium weight). */
.send {
  background: var(--primary);
  color: var(--on-primary);
  border: 0;
  border-radius: var(--r-sm);
  padding: 0 24px;
  height: 40px;
  font-family: var(--font-head);
  font-weight: 700;
  letter-spacing: 0.1px;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s;
}

.send:hover:not(:disabled) {
  background: var(--primary-hover);
  box-shadow: var(--shadow-sm);
}

.send:disabled {
  opacity: 0.38;
  cursor: default;
}

.tiny {
  font-size: 11px;
  color: var(--grey);
  text-align: center;
  margin-top: 6px;
}

.spin {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2.5px solid var(--accent-soft);
  border-top-color: var(--primary);
  animation: turn 0.8s linear infinite;
}

@keyframes turn {
  to {
    transform: rotate(360deg);
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes blink {
  0%,
  80%,
  100% {
    opacity: 0.25;
    transform: translateY(0);
  }

  40% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

/* ------------------------------------------------------------------------------------------ chat: frame */

body.chat {
  --drawer-w: clamp(420px, 36vw, 560px);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --side-w: 280px; /* the history sidebar in full screen */
  /* Chips (round 3): a light grey (about 15 % grey) with black text; red only when selected. */
  --chip-15: #d9d9d9;
  --chip-15-hover: #cccccc;
  /* No green or yellow text in the chat (MI-108): status colours are the neutrals; red stays for errors. */
  --ok: var(--muted);
  --ok-soft: var(--pale);
  --ok-line: var(--border);
  --warn: var(--muted);
  --warn-soft: var(--pale);
  display: flex;
  flex-direction: column;
  background: var(--canvas);
  color: var(--text);
}

header.topbar {
  background: var(--surface);
  color: var(--text);
  border-bottom: 1px solid var(--border);
  padding: 10px 14px;
  gap: 6px;
  flex-wrap: nowrap;
}

/* The conversation's title under the brand (round 3); one line, cut with an ellipsis. */
.ctitle {
  max-width: 100%;
  font-size: 12.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* The floating portal window moves with its header (the portal moves it; chat.js reports the drag). */
body.floating header.topbar {
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}

body.dragging,
body.dragging header.topbar {
  cursor: grabbing;
}

.mark,
.hero,
.ava {
  display: grid;
  place-items: center;
  flex: none;
  color: #ffffff;
  background: var(--primary);
}

.mark {
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
}

.titles {
  min-width: 0;
  margin-left: 4px;
  line-height: 1.2;
}

.topbar .brand {
  font-size: 15px;
  color: var(--text);
}

.topbar .brand span {
  color: var(--primary-text);
}

.subtitle {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat .disg {
  background: var(--pale);
  color: var(--text);
  border-radius: var(--r-xs);
  padding: 3px 9px;
  white-space: nowrap;
}

.chat .ctl {
  color: var(--muted);
}

.chat .ctl select {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--outline);
  border-radius: var(--r-xs);
}

/* M3 outlined buttons on the light bar. */
.chat a.adm,
.chat button.out {
  color: var(--text);
  border-color: var(--outline);
  border-radius: var(--r-sm);
  opacity: 1;
}

/* "New chat": an outlined button with a bold border and bold text, beside Close once a chat has started. The
   "N sources" button under an answer has the same look. */
.chat .hbtn {
  flex: none;
  height: 36px;
  padding: 0 14px;
  border: 2px solid var(--text);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-head);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s;
}

.chat .hbtn:hover {
  background: var(--chip);
}

.chat a.adm:hover,
.chat button.out:hover {
  color: var(--text);
  background: var(--chip);
  border-color: var(--outline);
}

.chat .who {
  color: var(--muted);
}

/* Icon button: a rounded rectangle, a state layer on hover. */
button.icon {
  width: 36px;
  height: 36px;
  border-radius: var(--r-sm);
  border: 0;
  background: transparent;
  color: var(--muted);
  display: grid;
  place-items: center;
  cursor: pointer;
  flex: none;
  transition: background 0.15s, color 0.15s;
}

button.icon:hover {
  background: var(--chip);
  color: var(--text);
}

/* Nothing of the chat shows until GET /api/auth/me has confirmed a session (chat.9139603f.js removes signing-in): without a user
   context the page renders no chat at all, only the reason it could not start. */
.chat.signing-in .stage,
.chat.signing-in .topbar .out {
  visibility: hidden;
}

.chat.signing-in #startMsg {
  visibility: visible;
}

/* The drawer is open when the chat first shows: no slide or fade on the way in. */
body.chat.signing-in .drawer {
  transition: none;
}

/* The start page scrolls on its own. The drawer lies over its right side; on wide screens the start page makes room
   for it (the same pattern as a docked panel), so nothing is ever covered. */
.chat .stage {
  flex: 1;
  min-height: 0;
  position: relative;
  overflow: hidden;
}

/* No scrollbar on the start page: with the drawer open it would stand in the middle of the screen. The page still
   scrolls with the wheel, the trackpad and the keyboard. */
.chat main {
  position: absolute;
  inset: 0;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
  transition: right 0.32s var(--ease);
}

.chat main::-webkit-scrollbar {
  display: none;
}

@media (min-width: 1024px) {
  body.drawer-open main {
    right: var(--drawer-w);
  }

  /* Nothing on the start page (no FAQ, no notice): the conversation takes the whole page, without a resize edge. */
  body.chat.nostart.drawer-open main {
    visibility: hidden;
  }

  body.chat.nostart .drawer {
    width: 100%;
    border-left: 0;
    box-shadow: none;
  }

  body.chat.nostart .dsizer {
    display: none;
  }
}

.chat .wrap {
  max-width: var(--measure, 760px);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* ------------------------------------------------------------------------------------------ chat: start page */

/* The start page holds the FAQ (and the pause and error notices) beside or under the conversation. */
.chat .start {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 32px 96px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.chat .pausenote,
.chat .paused,
.chat .startmsg {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0;
  padding: 10px 14px;
  border-radius: var(--r-md);
  font-size: 13.5px;
  line-height: 1.5;
}

.chat .pausenote .ico,
.chat .paused .ico,
.chat .startmsg .ico {
  flex: none;
  margin-top: 2px;
}

.chat .pausenote,
.chat .paused {
  background: var(--pale);
  color: var(--text);
}

.chat .pausenote {
  animation: rise 0.3s ease both;
}

.chat .startmsg {
  flex-wrap: wrap;
  align-items: center;
  background: var(--bad-soft);
  color: var(--bad);
}

.hero {
  width: 44px;
  height: 44px;
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
}

.hero .ico {
  width: 22px;
  height: 22px;
}

.chat .sugs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.chat .sugs:empty {
  display: none;
}

.chat .sug {
  max-width: 100%;
  border: 1px solid transparent;
  background: var(--chip-15);
  color: var(--dark-node);
  border-radius: var(--r-sm);
  padding: 6px 12px;
  min-height: 32px;
  font-size: 13px;
  line-height: 1.4;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.chat .sug:hover:not(:disabled) {
  background: var(--chip-15-hover);
}

/* Every way to ask (the suggestion, the FAQ, clarifying options) is disabled while the assistant is paused. */
.chat [data-ask]:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.chat .panel {
  min-width: 0;
}

.chat .phead {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 0 2px 12px;
}

.chat .phead h2 {
  margin: 0;
  font-family: var(--font-head);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0;
  color: var(--text);
}

.chat .pcount {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

/* ------------------------------------------------------------------------------------------ chat: FAQ */

.chat .faqbox {
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}

.chat .faqsearch {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  transition: box-shadow 0.15s;
}

.chat .faqsearch:focus-within {
  box-shadow: inset 0 -2px 0 var(--primary);
}

.chat .faqsearch:focus-within .faqico {
  color: var(--primary-text);
}

.chat .faqico {
  display: grid;
  place-items: center;
  flex: none;
  color: var(--muted);
}

.chat .faqsearch input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text);
  font-size: 14.5px;
  padding: 4px 0;
}

.chat .faqsearch input::placeholder {
  color: var(--muted);
}

.chat .cats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 12px 16px 4px;
}

/* M3 filter chip: outlined at rest, the tonal container with no outline when selected. */
.chat .cat {
  border: 1px solid transparent;
  background: var(--chip-15);
  color: var(--dark-node);
  border-radius: var(--r-sm);
  padding: 5px 12px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.chat .cat:hover {
  background: var(--chip-15-hover);
}

.chat .cat[aria-pressed="true"] {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-primary);
}

.chat .faqs {
  padding: 2px 0;
  transition: opacity 0.15s;
}

.chat .faqs[aria-busy="true"] {
  opacity: 0.6;
}

.chat .faq {
  transition: background 0.4s;
}

.chat .faq + .faq {
  border-top: 1px solid var(--border);
}

.chat .faq.hi {
  background: var(--accent-soft);
}

.chat .faqh {
  margin: 0;
  font-size: inherit;
  font-weight: inherit;
}

.chat .faqq {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px 16px;
  border: 0;
  background: none;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.45;
  text-align: left;
  cursor: pointer;
  transition: color 0.15s;
}

.chat .faqq:hover {
  color: var(--primary-text);
}

.chat .faqq span {
  flex: 1;
  min-width: 0;
}

.chat .faqq .ico {
  flex: none;
  color: var(--muted);
  transition: transform 0.24s var(--ease), color 0.15s;
}

.chat .faq.open .faqq .ico {
  transform: rotate(180deg);
  color: var(--primary-text);
}

/* The answer opens by animating its grid row from 0fr to 1fr; while closed it is invisible to focus and readers. */
.chat .faqa {
  display: grid;
  grid-template-rows: 0fr;
  visibility: hidden;
  transition: grid-template-rows 0.26s var(--ease), visibility 0s linear 0.26s;
}

.chat .faq.open .faqa {
  grid-template-rows: 1fr;
  visibility: visible;
  transition: grid-template-rows 0.26s var(--ease), visibility 0s;
}

.chat .faqin {
  min-height: 0;
  overflow: hidden;
}

.chat .faqtext {
  margin: 0 16px 12px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.chat .faqtext p {
  margin: 0 0 8px;
}

.chat .faqtext p:last-child {
  margin-bottom: 0;
}

.chat .faqtext a {
  color: var(--link);
  text-decoration: underline;
}

.chat .faqfoot {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 16px 16px;
}

.chat .faqcat {
  color: var(--muted);
  background: var(--chip);
  border-radius: var(--r-sm);
  padding: 2px 9px;
  font-size: 11.5px;
  font-weight: 600;
}

.chat .faqask {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  border: 0;
  background: var(--tonal);
  color: var(--text);
  border-radius: var(--r-sm);
  padding: 0 16px;
  height: 32px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s;
}

/* M3 tonal button. */
.chat .faqask:hover:not(:disabled) {
  background: var(--tonal-hover);
  box-shadow: var(--shadow-sm);
}

.chat .faqmsg {
  margin: 0;
  padding: 18px 16px;
  color: var(--muted);
  font-size: 13.5px;
}

.chat .faqall {
  display: block;
  width: 100%;
  padding: 12px 16px;
  border: 0;
  border-top: 1px solid var(--border);
  background: none;
  color: var(--primary-text);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
}

.chat .faqall:hover {
  background: var(--chip);
}

.chat .skel {
  height: 16px;
  margin: 18px 16px;
  border-radius: var(--r-xs);
  background: linear-gradient(90deg, var(--chip) 0%, var(--chip-strong) 50%, var(--chip) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}

.chat .skel:nth-child(2) {
  width: 72%;
}

.chat .skel:nth-child(3) {
  width: 84%;
}

@keyframes shimmer {
  from {
    background-position: 100% 0;
  }

  to {
    background-position: -100% 0;
  }
}

/* ------------------------------------------------------------------------------------------ chat: drawer */

.chat .drawer {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  width: var(--drawer-w);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transform: translateX(100%);
  visibility: hidden;
  container: drawer / inline-size;
  --measure: 760px; /* the conversation column's cap */
  transition: transform 0.32s var(--ease), width 0.32s var(--ease), visibility 0s linear 0.32s;
}

.chat.drawer-open .drawer {
  transform: none;
  visibility: visible;
  transition: transform 0.32s var(--ease), width 0.32s var(--ease), visibility 0s;
}

/* While the edge is dragged the drawer and the start page follow the pointer at once, and nothing is selected. */
.chat.sizing {
  cursor: col-resize;
  user-select: none;
  -webkit-user-select: none;
}

.chat.sizing main,
.chat.sizing .drawer {
  transition: none;
}

/* Beside the start page a resized or expanded drawer shows more text, not more margin (the sheet keeps 760 px). */
@media (min-width: 1024px) {
  .chat .drawer {
    --measure: 960px;
  }
}

/* The resize edge on the drawer's left border (wide screens only; chat.js sets the width through --drawer-w). An
   8 px grab area; a 2 px line and a grip appear on hover, and in the primary red on keyboard focus and while
   dragging. */
.chat .dsizer {
  position: absolute;
  top: 0;
  bottom: 0;
  left: -4px;
  z-index: 1;
  width: 8px;
  cursor: col-resize;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.chat .dsizer::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 3px;
  width: 2px;
  background: transparent;
  transition: background 0.15s;
}

.chat .dsizer::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 2px;
  width: 4px;
  height: 36px;
  margin-top: -18px;
  border-radius: 2px;
  background: var(--muted);
  opacity: 0;
  transition: opacity 0.15s, background 0.15s;
}

.chat .dsizer:hover::before {
  background: var(--accent-line);
}

.chat .dsizer:hover::after {
  opacity: 1;
}

/* The red line and grip are the focus indicator. */
.chat .dsizer:focus-visible {
  outline: none;
}

.chat .dsizer:focus-visible::before,
.chat.sizing .dsizer::before {
  background: var(--focus);
}

.chat .dsizer:focus-visible::after,
.chat.sizing .dsizer::after {
  background: var(--focus);
  opacity: 1;
}

.chat .thread {
  flex: 1;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin; /* a slim, quiet scrollbar for the conversation */
  scrollbar-color: var(--border) transparent;
  padding: 20px 20px 12px;
}

/* An empty conversation: centred icon, heading, one line and one suggestion. */
.chat .dempty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1 0 auto;
  text-align: center;
  padding: 24px 8px 48px;
  animation: rise 0.3s ease both;
}

/* The empty state fills the thread so it can sit in the middle. */
.chat .thread > .wrap {
  min-height: 100%;
}

.chat .dempty .hero {
  width: 40px;
  height: 40px;
  border-radius: var(--r-md);
  margin-bottom: 14px;
}

.chat .dempty h3 {
  margin: 0 0 4px;
  font-family: var(--font-head);
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.chat .dempty p {
  max-width: 34ch;
  margin: 0;
  color: var(--muted);
  font-size: 13.5px;
}

.chat .dempty .sugs {
  justify-content: center;
  margin-top: 18px;
}

/* Compare vendors: the button under the empty conversation's suggestion, and the form that takes the thread's place
   in the drawer (MI-108 look: white surfaces, rounded rectangles, outlined fields, no tinted cards). */
.chat .cmpstart {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px auto 0;
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid var(--outline);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-head);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

/* The small Compare vendors button sits under the composer of an empty conversation only (round 3). */
body.chat:not(.blank) .cmpstart {
  display: none;
}

.chat .cmpstart:hover {
  background: var(--chip);
}

.chat .cmpview {
  flex: 1;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
  padding: 16px 20px 20px;
}

.chat .cmpform {
  max-width: var(--measure, 760px);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.chat .cmphead h2 {
  margin: 10px 0 2px;
  font-family: var(--font-head);
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.chat .cmpsub,
.chat .cmphint {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

/* MI-152: the suppliers the conversation keeps to, a quiet line under the answer */
.chat .focusnote {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12.5px;
}

/* MI-149 family: every supplier a list answer fits, the rest behind "Show all N" */
.chat .allsup {
  margin: 6px 0 0;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  background: var(--chip);
  color: var(--text);
  font-size: 13px;
}

.chat .allsup-row,
.chat .allsup-head {
  margin: 0;
}

.chat .allsup-head {
  margin-top: 6px;
  color: var(--muted);
}

.chat .allsup-list {
  margin: 4px 0 0;
  padding-left: 18px;
  columns: 2 200px;
}

.chat .allsup-more[hidden] {
  display: none;
}

.chat .cmpfrom,
.chat .cmpfull {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  margin: 6px 0 0;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  background: var(--chip);
  color: var(--text);
  font-size: 13px;
}

.chat .cmpinstead {
  padding: 2px 0;
  border: 0;
  background: none;
  color: var(--link);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.chat .cmpinstead:hover {
  text-decoration: underline;
}

.chat .cmpback {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
  border: 0;
  background: none;
  color: var(--link);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.chat .cmpback:hover span {
  text-decoration: underline;
}

.chat .cmpsec {
  margin: 0;
  padding: 0;
  border: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.chat .cmpsec legend {
  padding: 0;
  margin-bottom: 8px;
  font-family: var(--font-head);
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.chat .cmpinput {
  width: 100%;
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--outline);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 14px;
}

.chat .cmpinput:focus {
  outline: none;
  border-color: var(--focus);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.chat .cmpinput:disabled {
  opacity: 0.55;
}

.chat .cmpchips,
.chat .cmptoggles {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chat .cmpchips:empty {
  display: none;
}

.chat .cmpchip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  min-height: 32px;
  padding: 0 4px 0 10px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  background: var(--chip-15);
  color: var(--dark-node);
  font-size: 13px;
  font-weight: 700;
}

.chat .cmpx {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: var(--r-xs);
  background: none;
  color: var(--muted);
  cursor: pointer;
}

.chat .cmpx:hover {
  background: var(--chip);
  color: var(--text);
}

.chat .cmplist {
  list-style: none;
  margin: 0;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  max-height: 260px;
  overflow: auto;
}

.chat .cmpopt {
  display: block;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: var(--r-xs);
  background: none;
  color: var(--text);
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}

.chat .cmpopt:hover,
.chat .cmpopt:focus-visible {
  background: var(--chip);
}

.chat .cmpnone {
  padding: 8px 10px;
  color: var(--muted);
  font-size: 13px;
}

.chat .cmpcrit {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat .cmpgroup {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.chat .cmpglabel {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

/* Criteria chips: light grey with black text, red when chosen (red, black and grey only). */
.chat .cmptoggle {
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  background: var(--chip-15);
  color: var(--dark-node);
  font-size: 13px;
  cursor: pointer;
}

.chat .cmptoggle:hover {
  background: var(--chip-15-hover);
}

.chat .cmptoggle[aria-pressed="true"] {
  border-color: var(--primary);
  background: var(--primary);
  color: var(--on-primary);
  font-weight: 700;
}

.chat .cmptoggle[aria-pressed="true"]:hover {
  border-color: var(--primary-hover);
  background: var(--primary-hover);
}

.chat .cmpallrow,
.chat .cmpgrow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.chat .cmpall {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  background: var(--chip-strong);
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.chat .cmpall .ico {
  visibility: hidden;
}

.chat .cmpall[aria-pressed="true"] {
  background: var(--primary);
  color: var(--on-primary);
}

.chat .cmpall[aria-pressed="true"] .ico {
  visibility: visible;
}

.chat .cmpghead {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 4px;
  border: 0;
  border-radius: var(--r-xs);
  background: none;
  color: var(--text);
  cursor: pointer;
}

.chat .cmpghead:hover {
  background: var(--chip);
}

.chat .cmpghead .ico {
  transition: transform 0.15s ease;
}

.chat .cmpghead[aria-expanded="false"] .ico {
  transform: rotate(-90deg);
}

.chat .cmpgcount {
  color: var(--muted);
  font-size: 12px;
}

.chat .cmpgall {
  margin-left: auto;
  padding: 2px 6px;
  border: 0;
  border-radius: var(--r-xs);
  background: none;
  color: var(--link);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.chat .cmpgall:hover {
  background: var(--chip);
}

.chat .cmprow {
  display: flex;
  gap: 8px;
}

.chat .cmpadd {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--outline);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.chat .cmpadd:hover {
  background: var(--chip);
}

.chat .cmpnote {
  margin: 0;
  color: var(--bad);
  font-size: 13px;
}

.chat .cmpnote:empty {
  display: none;
}

.chat .cmpfoot {
  display: flex;
  justify-content: flex-end;
}

.chat .cmpgo {
  min-height: 40px;
  padding: 0 20px;
  border: 0;
  border-radius: var(--r-sm);
  background: var(--primary);
  color: var(--on-primary);
  font-family: var(--font-head);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.chat .cmpgo:hover:not(:disabled) {
  background: var(--primary-hover);
}

.chat .cmpgo:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.chat .nudge {
  max-width: var(--measure, 760px);
  margin: 8px auto 0;
  text-align: center;
  font-size: 12.5px;
}

.chat .nudge a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--primary-text);
  font-weight: 600;
  text-decoration: none;
}

.chat .nudge a:hover {
  text-decoration: underline;
}

.chat .privacy {
  max-width: var(--measure, 760px);
  margin: 6px auto 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 6px;
  font-size: 11.5px;
  line-height: 1.4;
  color: var(--muted);
  text-align: center;
}

.chat .privacy a {
  color: inherit;
  text-decoration: underline;
  white-space: nowrap;
}

.chat .privacy .privx {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.chat .privacy .privx:hover,
.chat .privacy .privx:focus-visible {
  background: var(--line);
}

.chat .fromfaq {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 14px;
  margin-top: 10px;
  padding: 8px 0 0;
  border-top: 1px solid var(--border);
  font-size: 12.5px;
  line-height: 1.4;
}

/* A small help label, not a heading: the answer's sources keep the bold "N sources" button. */
.chat .fromfaqh {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  font-weight: 400;
}

.chat .fromfaqh .ico {
  flex: none;
  align-self: center;
}

/* Plain text links (underlined), not chips or questions. */
.chat .faqlink {
  display: inline;
  padding: 0;
  border: 0;
  border-radius: var(--r-xs);
  background: none;
  color: var(--link);
  font: inherit;
  font-weight: 400;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.chat .faqlink:hover {
  text-decoration-thickness: 2px;
}

.chat .faqlink span {
  overflow-wrap: anywhere;
}

/* Shown on the start page while the drawer is closed and the thread has something in it. */
.chat .resume {
  position: absolute;
  right: 24px;
  bottom: 24px;
  z-index: 5;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 56px;
  padding: 0 20px 0 16px;
  border: 0;
  border-radius: var(--r-lg);
  background: var(--primary);
  color: var(--on-primary);
  font-family: var(--font-head);
  font-size: 14px;
  font-weight: 700;
  box-shadow: var(--shadow-lg);
  cursor: pointer;
  animation: rise 0.25s ease both;
  transition: background 0.15s, box-shadow 0.2s var(--ease);
}

/* M3 extended FAB: level 3, level 4 feel on hover through a darker fill. */
.chat .resume:hover {
  background: var(--primary-hover);
}

/* ------------------------------------------------------------------------------------------ chat: messages */

.msg {
  display: flex;
  gap: 10px;
  animation: rise 0.25s ease both;
}

.msg.user {
  justify-content: flex-end;
}

.chat .bubble {
  min-width: 0;
}

.msg.bot .bubble {
  flex: 1;
  position: relative; /* the reference card is placed inside it */
}

/* The partner's own words sit in a neutral grey bubble; red stays for actions. */
.msg.user .bubble {
  max-width: 85%;
  background: var(--user);
  color: var(--text);
  padding: 10px 16px;
  border-radius: var(--r-md);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 15.5px;
}

.ava {
  width: 28px;
  height: 28px;
  border-radius: var(--r-sm);
  margin-top: 1px;
}

.ans {
  font-size: 15.5px;
  line-height: 1.6;
  color: var(--text);
  overflow-wrap: anywhere;
}

.ans p {
  margin: 0 0 10px;
}

.ans p:last-child {
  margin-bottom: 0;
}

.ans ul,
.ans ol {
  margin: 0 0 10px;
  padding-left: 20px;
}

.ans li {
  margin: 3px 0;
}

.ans h3 {
  font-family: var(--font-head);
  font-size: 15.5px;
  margin: 14px 0 6px;
}

.ans a {
  color: var(--link);
}

.ans code {
  font-family: var(--font-mono);
  font-size: 12.5px;
  background: var(--chip);
  padding: 1px 5px;
  border-radius: var(--r-xs);
}

.ans pre {
  background: var(--chip);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  overflow-x: auto;
}

.ans pre code {
  background: none;
  padding: 0;
}

/* A reference in the answer: a small grey tag with the supplier's name ("+2" for more sources behind the claim). */
.cite {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  max-width: 16rem;
  height: 18px;
  padding: 0 6px;
  margin: 0 1px;
  border: 0;
  border-radius: var(--r-xs);
  background: var(--chip);
  color: var(--muted);
  font: 600 11px/1 var(--font-body);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: 1px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.cite:hover,
.cite[aria-expanded="true"] {
  background: var(--chip-strong);
  color: var(--text);
}

.cite .more {
  color: var(--muted);
  font-weight: 700;
}

/* The reference card: the source titles (links when they have one) and an excerpt when the API sends it. */
.citecard {
  position: absolute;
  z-index: 20;
  width: min(320px, 100%);
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--shadow-md);
  font-size: 12.5px;
  line-height: 1.45;
}

.citeitem + .citeitem {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.citet {
  display: block;
  color: var(--text);
  font-weight: 700;
  overflow-wrap: anywhere;
}

a.citet {
  color: var(--link);
}

.citex {
  margin: 4px 0 0;
  color: var(--muted);
}

.tbl {
  overflow-x: auto;
  margin: 8px 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
}

.tbl table {
  border-collapse: collapse;
  width: max-content;
  min-width: 100%;
  font-size: 13px;
}

/* Columns keep a readable width and the table scrolls sideways in a narrow drawer (never one letter per line). */
.tbl th,
.tbl td {
  min-width: 8rem;
  max-width: 16rem;
  overflow-wrap: break-word;
  padding: 7px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.tbl th {
  background: var(--chip);
  font-weight: 700;
}

.tbl tr:last-child td {
  border-bottom: 0;
}

/* A comparison table: the criterion column stays in view while the suppliers scroll sideways; section rows span the
   table with their label kept in view too. */
.tbl.cmptbl {
  max-height: 70vh;
  overflow: auto;
}

.tbl.cmptbl th {
  position: sticky;
  top: 0;
  z-index: 2;
}

.tbl.cmptbl th:first-child,
.tbl.cmptbl td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--surface);
  font-weight: 700;
  box-shadow: 1px 0 0 var(--border);
}

.tbl.cmptbl th:first-child {
  z-index: 3;
  background: var(--chip);
}

.tbl.cmptbl td.cmpband {
  position: static;
  max-width: none;
  background: var(--chip-strong);
  box-shadow: none;
}

.tbl.cmptbl .cmpbandlabel {
  position: sticky;
  left: 10px;
  display: inline-block;
}

.cmpexport {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: -4px 0 12px;
}

.cmpexport .spacer {
  flex: 1;
}

.cmpdifflabel {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  cursor: pointer;
}

.cmpdiffbox {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--primary);
}

/* "Show differences only": rows where every supplier says the same, and sections left with none, are hidden. */
.tbl.cmptbl.cmpdiff tr[data-same] {
  display: none;
}

/* Full screen fits a comparison to the width (up to five suppliers on a 1280 px screen): fixed columns that wrap,
   the criterion column a little wider. Docked and floating keep the sideways scroll. */
body.chat.full .tbl.cmptbl table {
  table-layout: fixed;
  width: 100%;
  min-width: calc(14rem + var(--cmp-cols, 5) * 9rem);
}

body.chat.full .tbl.cmptbl th,
body.chat.full .tbl.cmptbl td {
  min-width: 0;
  max-width: none;
  overflow-wrap: anywhere;
}

body.chat.full .tbl.cmptbl th:first-child {
  width: 14rem;
}

.cmpcsv {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid var(--outline);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.cmpcsv:hover {
  background: var(--chip);
}

.ph {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
  padding: 5px 0;
}

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

.typing i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary);
  opacity: 0.35;
  animation: blink 1.2s infinite ease-in-out;
}

.typing i:nth-child(2) {
  animation-delay: 0.15s;
}

.typing i:nth-child(3) {
  animation-delay: 0.3s;
}

.phase {
  letter-spacing: 0.1px;
}

/* ------------------------------------------------------------------------------------------ chat: answer footer */

.acts {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-top: 10px;
}

.acts .spacer {
  flex: 1;
  min-width: 8px;
}

/* "No matching supplier source": a neutral label, shown only in the no-match state. */
.cue {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  padding: 2px 8px;
  border-radius: var(--r-xs);
  background: var(--chip);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.notkept {
  color: var(--muted);
  font-style: italic;
}

/* "Raise a ticket" (SR-57): a quiet text link at the end of the action row, shown only when an admin set the form. */
.acts .ticket {
  margin-left: 6px;
  padding: 4px 6px;
  border-radius: var(--r-sm);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.acts .ticket:hover,
.acts .ticket:focus-visible {
  background: var(--chip);
  color: var(--text);
}

.okline {
  color: var(--muted);
  font-weight: 700;
}

.ib {
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  border: 0;
  background: transparent;
  color: var(--muted);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.ib:hover {
  background: var(--chip);
  color: var(--text);
}

/* Copy: "Copied" is written beside the icon for a moment (chat.9139603f.js adds and removes the class). */
.ib.flashed {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  width: auto;
  padding: 0 8px;
  color: var(--text);
  background: var(--chip);
}

.flashtext {
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.ib.on {
  color: var(--text);
  background: var(--chip-strong);
}

/* "Report as wrong": the flag turns red while the answer is reported (the thumbs keep the accent colour). */
.ib.flag.on {
  color: var(--bad);
  background: var(--bad-soft);
}

/* "N sources": the same look as New chat (bold border, bold text); it opens a compact list of the sources. */
.srcbtn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: none;
  height: 28px;
  padding: 0 8px 0 10px;
  border: 2px solid var(--text);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-head);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
}

.srcbtn:hover {
  background: var(--chip);
}

.srcbtn[aria-expanded="true"] .ico {
  transform: rotate(180deg);
}

.srclist {
  width: fit-content;
  min-width: 14rem;
  max-width: 100%;
  margin: 6px 0 0;
  padding: 4px 0;
  list-style: none;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  font-size: 12.5px;
  line-height: 1.4;
}

.srclist li {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 5px 12px;
  min-width: 0;
}

.srclist a,
.srclist span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.srclist a {
  color: var(--text);
  text-decoration: none;
}

.srclist a:hover {
  color: var(--link);
  text-decoration: underline;
}

.srcrel {
  flex: none;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
}

.fbform {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  animation: rise 0.2s ease both;
}

/* M3 outlined text field: 4 px corners; focus is a 2 px primary outline. */
.fbform input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--outline);
  border-radius: var(--r-xs);
  padding: 8px 12px;
  font-size: 13px;
  background: var(--surface);
  color: var(--text);
}

.fbform input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: inset 0 0 0 1px var(--primary);
}

/* The report form: the note, then Report or Update, Withdraw report and Cancel, wrapping in the narrow portal panel. */
.wrongform {
  flex-wrap: wrap;
  align-items: center;
}

.wrongform input {
  flex: 1 1 12rem;
}

.fbs {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

.fbs:empty {
  margin-top: 0;
}

.next {
  margin-top: 12px;
}

/* "Talk to an Intelisys rep": an outlined button (a rounded rectangle). */
.rep {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 14px 0 12px;
  border: 2px solid var(--text);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
}

.rep:hover {
  background: var(--chip);
}

.rep[aria-disabled="true"] {
  opacity: 0.65;
  cursor: default;
}

.clarify {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.opt {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 11px 14px;
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.opt:hover {
  border-color: var(--accent-line);
  box-shadow: var(--shadow-sm);
}

.optbody {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.optl {
  font-weight: 700;
  font-size: 14px;
}

.optd {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.4;
}

.opt .ico {
  flex: none;
  color: var(--muted);
  transition: transform 0.15s, color 0.15s;
}

.opt:hover .ico {
  color: var(--primary-text);
  transform: translateX(2px);
}

/* ------------------------------------------------------------------------------------------ chat: notes and cards */

.note {
  font-size: 13.5px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 10px 12px;
}

.cnote {
  font-size: 12.5px;
  color: var(--muted);
  background: var(--pale);
  border-radius: var(--r-sm);
  padding: 8px 10px;
  margin: 8px 0;
}

.err {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  color: var(--bad);
  background: var(--bad-soft);
  border-radius: var(--r-md);
  padding: 10px 12px;
  font-size: 13.5px;
  margin-top: 8px;
}

/* M3 text button: no container until hover. */
.linkbtn {
  background: none;
  border: 0;
  border-radius: var(--r-sm);
  color: var(--primary-text);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  padding: 4px 8px;
  margin: -4px -6px;
  transition: background 0.15s;
}

.linkbtn:hover:not(:disabled) {
  background: var(--accent-soft);
}

.linkbtn:disabled {
  opacity: 0.5;
  cursor: default;
}

.stopped {
  color: var(--muted);
  font-size: 12px;
  font-style: italic;
  margin-top: 6px;
}

.chat .lead {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-start;
  border: 1px solid var(--ok-line);
  background: var(--ok-soft);
  border-radius: var(--r-md);
  padding: 10px 12px;
  margin-top: 8px;
  font-size: 13.5px;
}

.leadico {
  width: 22px;
  height: 22px;
  border-radius: var(--r-xs);
  background: var(--text);
  color: #ffffff;
  display: grid;
  place-items: center;
  flex: none;
}

.leadsub {
  color: var(--muted);
  font-size: 12.5px;
}

.leadmail {
  width: 100%;
  font-size: 12.5px;
}

.leadmail summary {
  cursor: pointer;
  color: var(--muted);
}

.leadmail pre {
  white-space: pre-wrap;
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 10px;
  max-height: 260px;
  overflow: auto;
}

/* ------------------------------------------------------------------------------------------ chat: CRM hand-off */

/* One card per lead (chat.9139603f.js crmParts); data-state is ask, sending, slow, sent, failed or declined (a quiet line). */
.chat .crm {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--r-md);
  padding: 10px 12px;
  margin-top: 8px;
  font-size: 13.5px;
  transition: background 0.2s, border-color 0.2s;
}

/* The card takes focus only to keep it in place when its buttons change; a mouse user sees no ring. */
.chat .crm:focus:not(:focus-visible) {
  outline: none;
}

.chat .crm[data-state="ask"] {
  border-color: var(--accent-line);
  background: var(--accent-soft);
}

.chat .crm[data-state="sent"] {
  border-color: var(--ok-line);
  background: var(--ok-soft);
}

.chat .crm[data-state="failed"] {
  border-color: transparent;
  background: var(--bad-soft);
}

.chat .crm[data-state="slow"] {
  border-color: transparent;
  background: var(--warn-soft);
}

.chat .crm[data-state="declined"] {
  border-color: transparent;
  background: none;
  padding: 0 2px;
  font-size: 12.5px;
}

.crmrow {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  min-width: 0;
}

.crm[data-state="declined"] .crmrow {
  align-items: center;
  gap: 6px;
}

.crmico {
  width: 22px;
  height: 22px;
  border-radius: var(--r-xs);
  display: grid;
  place-items: center;
  flex: none;
  background: var(--primary);
  color: #ffffff;
}

.crm[data-state="sent"] .crmico {
  background: var(--text);
}

.crm[data-state="sending"] .crmico,
.crm[data-state="slow"] .crmico,
.crm[data-state="failed"] .crmico {
  background: none;
}

.crm[data-state="slow"] .crmico {
  color: var(--warn);
}

.crm[data-state="failed"] .crmico {
  color: var(--bad);
}

/* Under reduced motion the ring stands still (see the list at the end); the text says what is happening. */
.crm .spin {
  width: 16px;
  height: 16px;
  border-width: 2px;
}

.crmbody {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.crmt {
  font-weight: 700;
  color: var(--text);
  overflow-wrap: anywhere;
}

.crm[data-state="failed"] .crmt {
  color: var(--bad);
}

.crm[data-state="declined"] .crmt {
  font-weight: 400;
  color: var(--muted);
}

.crmsub {
  color: var(--muted);
  font-size: 12.5px;
  overflow-wrap: anywhere;
}

.crmacts {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  margin-top: 8px;
}

/* M3 filled button. */
.crmsend {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 24px;
  border: 0;
  border-radius: var(--r-sm);
  background: var(--primary);
  color: var(--on-primary);
  font-family: var(--font-head);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.1px;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s;
}

.crmsend:hover {
  background: var(--primary-hover);
  box-shadow: var(--shadow-sm);
}

.crm [aria-disabled="true"] {
  opacity: 0.6;
  cursor: default;
}

.linkbtn.quiet {
  color: var(--muted);
}

.chat .card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 12px 14px;
  margin-bottom: 10px;
}

.chat .card h4 {
  font-family: var(--font-head);
  font-size: 13.5px;
  margin: 0 0 8px;
}

/* The shortlist: a header (title and requirement), then numbered rows. */
.chat .shortlist {
  padding: 0;
  overflow: hidden;
}

.slhead {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--pale);
}

.chat .slhead h4 {
  margin: 0;
}

.slreq {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12.5px;
}

.slrows {
  margin: 0;
  padding: 0 14px;
  list-style: none;
}

.rank {
  display: flex;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
}

.rank:last-child {
  border-bottom: 0;
}

.rank .pos {
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: var(--r-xs);
  background: var(--chip);
  color: var(--text);
  font-weight: 700;
  font-size: 12px;
  display: grid;
  place-items: center;
}

.rank .nm {
  font-weight: 700;
}

.ev {
  font-size: 12.5px;
  color: var(--muted);
}

.ev .y {
  color: var(--text);
}

.ev .n {
  color: var(--muted);
}

.chat .shortlist .cnote {
  margin: 0 14px 12px;
}

/* ------------------------------------------------------------------------------------------ chat: composer */

/* Pinned at the bottom once a chat has started (in the middle of an empty one). The paper plane inside the box sends
   (as Enter does; Shift+Enter is a new line) and becomes Stop while an answer streams. */
.chat .drawer footer {
  border-top: 0;
  background: var(--surface);
  padding: 8px 16px 14px;
}

/* An outlined field, a rounded rectangle about three lines tall (round 3), growing with the text; red outline on
   focus. The placeholder sits top left, the send arrow bottom right inside the box. */
.composer {
  position: relative;
  max-width: var(--measure, 760px);
  margin: 0 auto;
  display: block;
  background: var(--surface);
  border: 1px solid var(--outline);
  border-radius: var(--r-md);
  padding: 0;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.composer:focus-within {
  border-color: var(--primary);
  box-shadow: inset 0 0 0 1px var(--primary);
}

.composer textarea {
  display: block;
  width: 100%;
  border: 0;
  outline: none;
  resize: none;
  background: transparent;
  color: var(--text);
  font-size: 15px;
  line-height: 22px;
  padding: 12px 54px 12px 14px;
  height: 90px;
  min-height: 90px;
  max-height: 220px;
  border-radius: var(--r-md);
}

.composer textarea::placeholder {
  color: var(--muted);
}

/* A long placeholder stays on its first line (no wrapped second line, no scrollbar). */
.composer textarea:placeholder-shown {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.composer textarea:disabled {
  cursor: not-allowed;
}

/* Send: a light grey paper plane in the lower right corner of the box; Stop (a dark square) while an answer streams. */
.composer .send {
  position: absolute;
  right: 8px;
  bottom: 8px;
  width: 36px;
  height: 36px;
  margin: 0;
  padding: 0;
  border-radius: var(--r-sm);
  display: grid;
  place-items: center;
  background: transparent;
  color: var(--echo-grey);
}

.composer .send:hover:not(:disabled) {
  background: var(--chip);
  color: var(--text);
  box-shadow: none;
}

.composer .send.stop {
  width: 30px;
  height: 30px;
  right: 10px;
  bottom: 10px;
  background: var(--text);
  color: var(--surface);
}

.composer .send.stop:hover:not(:disabled) {
  background: var(--graphite);
  color: var(--surface);
}

.composer .send .ico {
  width: 20px;
  height: 20px;
}

.composer .send.stop .ico {
  width: 16px;
  height: 16px;
}

/* The character count: neutral grey, only near the limit. */
.chat .qcount {
  max-width: var(--measure, 760px);
  margin: 4px auto 0;
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.chat .qcount.over {
  color: var(--text);
  font-weight: 700;
}

/* ------------------------------------------------------------------------------------------ chat: narrow screens */

/* Under 1024 px the drawer is a full-screen sheet over a condensed, single-column start page (which goes inert while
   the sheet is open). The breakpoint is repeated in chat.js (the "sheet" media query). */
@media (max-width: 1023.98px) {
  .chat .drawer {
    left: 0;
    width: auto;
    border-left: 0;
    box-shadow: none;
    opacity: 0;
    transform: translateY(16px);
    transition: transform 0.28s var(--ease), opacity 0.2s ease, visibility 0s linear 0.28s;
  }

  .chat.drawer-open .drawer {
    opacity: 1;
    transform: none;
    transition: transform 0.28s var(--ease), opacity 0.2s ease, visibility 0s;
  }

  /* The sheet always covers the window: nothing to resize. */
  .chat .dsizer {
    display: none;
  }

  .chat .start {
    padding: 28px 20px 88px;
    gap: 22px;
  }
}

/* ------------------------------------------------------------------------------------------ chat: portal panel */

body.embedded header.topbar {
  padding: 10px 8px 10px 14px;
}

body.embedded .start {
  padding: 18px 14px 84px;
  gap: 18px;
}

body.embedded .thread {
  padding: 14px 14px 8px;
}

body.embedded .drawer footer {
  padding: 6px 12px 10px;
}

body.embedded .resume {
  right: 14px;
  bottom: 14px;
}

/* The portal's Assistant page: the full start page and drawer under the portal's own header, so the assistant's top
   bar (brand, sign-out) is not repeated there. */
body.portal-page header.topbar {
  display: none;
}

/* The portal panel sets its own size (chat.9139603f.js never shows the edge there either). */
body.embedded .dsizer {
  display: none;
}

/* ------------------------------------------------------------------------------------------ chat: empty conversation */

/* Round 3: an empty conversation keeps the composer in the middle, under the icon and heading; it moves to the bottom
   once a chat starts (chat.9139603f.js removes "blank"). */
.chat.blank .drawer {
  justify-content: center;
}

.chat.blank .thread {
  flex: 0 1 auto;
  padding-bottom: 4px;
}

.chat.blank .thread > .wrap {
  min-height: 0;
}

.chat.blank .dempty {
  padding: 8px 8px 12px;
}

.chat.blank .drawer footer {
  padding-bottom: 32px;
}

/* ------------------------------------------------------------------------------------------ chat: full screen */

/* Full screen (the portal panel expanded, or the portal's Assistant page): the history sidebar on the left and the
   conversation across the rest; the FAQ is a view that covers the conversation (MI-128), never a column beside it. */
.chat .side {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 11;
  width: var(--side-w);
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 16px 12px 24px;
  background: var(--canvas);
  border-right: 1px solid var(--border);
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

body.chat.full main {
  left: var(--side-w);
  right: 0;
}

body.chat.full.drawer-open main {
  right: 0;
  visibility: hidden;
}

body.chat.full .drawer {
  left: var(--side-w);
  right: 0;
  width: auto;
  border-left: 0;
  box-shadow: none;
}

body.chat.full .dsizer {
  display: none;
}

body.chat.full .drawer footer {
  padding: 8px 24px 18px;
}

body.chat.full .resume {
  right: 24px;
  bottom: 24px;
}

/* The empty conversation in full screen, as the mock-up: a large mark, heading and line over the centred composer. */
body.chat.full .dempty .hero {
  width: 72px;
  height: 72px;
  border-radius: var(--r-lg);
  margin-bottom: 22px;
  box-shadow: var(--shadow-sm);
}

body.chat.full .dempty .hero .ico {
  width: 36px;
  height: 36px;
}

body.chat.full .dempty h3 {
  font-size: 28px;
  margin-bottom: 10px;
}

body.chat.full .dempty p {
  max-width: 46ch;
  font-size: 18px;
  line-height: 1.5;
}

body.chat.full .composer {
  max-width: 860px;
}

body.chat.full .composer textarea {
  height: 120px;
  min-height: 120px;
  font-size: 16px;
}

.chat .sideitem {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 44px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--r-sm);
  background: none;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s;
}

.chat .sideitem:hover,
.chat .sideitem[aria-pressed="true"] {
  background: var(--chip);
}

.chat .sideico {
  display: grid;
  place-items: center;
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  color: var(--text);
}

.chat .sideico.plus {
  background: var(--chip);
}

.chat .sidehead {
  margin: 22px 10px 6px;
  font-family: var(--font-head);
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.chat .hist {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.chat .histgroup {
  display: flex;
  flex-direction: column;
}

.chat .histh {
  margin: 6px 10px 4px;
  font-size: 13px;
  font-weight: 400;
  color: var(--muted);
}

.chat .histlist {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.chat .hrow {
  display: flex;
  align-items: center;
  min-width: 0;
  border-radius: var(--r-sm);
  transition: background 0.15s;
}

.chat .hrow:hover,
.chat .hrow.cur {
  background: var(--chip);
}

.chat .hitem {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 0 6px 0 10px;
  border: 0;
  border-radius: var(--r-sm);
  background: none;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14.5px;
  text-align: left;
  cursor: pointer;
}

.chat .hitem .ico {
  flex: none;
  color: var(--muted);
}

.chat .hrow.cur .hitem {
  font-weight: 700;
}

.chat .htext {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* The pencil shows on hover and focus (always on touch screens). */
.chat .hedit {
  flex: none;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin-right: 6px;
  border: 0;
  border-radius: var(--r-sm);
  background: none;
  color: var(--muted);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s, background 0.15s;
}

.chat .hrow:hover .hedit,
.chat .hrow:focus-within .hedit,
.chat .hrow.cur .hedit {
  opacity: 1;
}

.chat .hedit:hover {
  background: var(--chip-strong);
  color: var(--text);
}

@media (hover: none) {
  .chat .hedit {
    opacity: 1;
  }
}

.chat .hinput {
  width: 100%;
  height: 40px;
  padding: 0 10px;
  border: 1px solid var(--primary);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 14.5px;
  outline: none;
  box-shadow: inset 0 0 0 1px var(--primary);
}

.chat .histnote {
  margin: 4px 10px;
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 760px) {
  body.chat.full {
    --side-w: 220px;
  }
}

@media (max-width: 640px) {
  .msg.user .bubble {
    max-width: 92%;
  }

  header {
    padding: 8px 12px;
    gap: 10px;
  }

  .ctl select {
    max-width: 140px;
  }

  body:not(.embedded) header.topbar {
    flex-wrap: wrap;
  }

  .who {
    display: none;
  }

  .chat .start {
    padding: 20px 14px 84px;
    gap: 18px;
  }

  .chat .thread {
    padding: 16px 14px 8px;
  }

  .chat .drawer footer {
    padding: 6px 12px 10px;
  }

  .chat .resume {
    right: 16px;
    bottom: 16px;
  }

  .chat .hbtn {
    padding: 0 10px;
  }
}

@media (pointer: coarse) {
  .composer textarea,
  .fbform input,
  .field input,
  .chat .faqsearch input {
    font-size: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .connect,
  .msg,
  .fbform,
  .typing i,
  .spin,
  .crm .spin,
  .chat .pausenote,
  .chat .dempty,
  .chat .resume,
  .chat .skel {
    animation: none;
  }
}

/* ------------------------------------------------------------------------------------------ sign-in page */

body.login {
  display: flex;
  flex-direction: column;
}

.login main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

/* M3 elevated card; the red rule on top ties it to the header. */
.signin {
  width: 100%;
  max-width: 380px;
  background: var(--card);
  border: 0;
  border-top: 4px solid var(--primary);
  border-radius: var(--r-md);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

body.embed {
  display: flex;
  flex-direction: column;
  background: var(--canvas);
  color: var(--text);
}

.embed main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 20px 48px;
}

.connect {
  width: 100%;
  max-width: 320px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  animation: rise 0.3s ease both;
}

.connect h1 {
  font-family: var(--font-head);
  font-size: 17px;
  font-weight: 700;
  margin: 10px 0 0;
}

.connect .sub {
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 8px;
}

.connect .formerr {
  text-align: left;
  width: 100%;
}

.signin h1 {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 22px;
  margin: 0 0 4px;
  letter-spacing: 0;
}

.signin .sub {
  color: var(--grey);
  margin: 0 0 18px;
  font-size: 13.5px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 14px;
}

.field label {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 13px;
  color: var(--ink);
}

/* M3 outlined text field. */
.field input {
  border: 1px solid var(--outline);
  border-radius: var(--r-xs);
  padding: 0 14px;
  height: 48px;
  background: var(--card);
  color: var(--ink);
  font-size: 15px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field input:hover {
  border-color: var(--ink);
}

.field input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: inset 0 0 0 1px var(--primary);
}

.send.wide {
  width: 100%;
}

.formerr {
  color: var(--bad);
  font-size: 13px;
  margin: 0 0 12px;
  padding: 8px 10px;
  border-left: 3px solid var(--bad);
  background: var(--bad-soft);
  border-radius: 0 var(--r-xs) var(--r-xs) 0;
}

.caps {
  color: var(--grey);
  font-size: 12px;
}

.login footer {
  border-top: 0;
}
