/*
 * pyrix.org · the support window (site + dashboard): on the site a framed key at the bottom right and a floating panel
 * of black glass; on the dashboard the same panel as a drawer on the right, opened by the head's help key. Self-contained tokens, so it reads the same on both surfaces (DESIGN.md: floating overlays may blur).
 */
.sup {
  --s-void: #000;
  --s-edge: rgba(255, 255, 255, 0.075);
  --s-edge-2: rgba(255, 255, 255, 0.13);
  --s-edge-hi: rgba(255, 255, 255, 0.22);
  --s-text: #f2f4f7;
  --s-text-2: #a4a9b4;
  --s-text-3: #767d8a;
  --s-blue: #3b82f6;
  --s-blue-2: #60a5fa;
  --s-blue-btn: #1d64e0;
  --s-blue-btn-2: #1e66e6;
  --s-blue-ink: #93c5fd;
  --s-wash: rgba(59, 130, 246, 0.1);
  --s-line-blue: rgba(59, 130, 246, 0.55);
  --s-green: #22c55e;
  --s-green-ink: #86efac;
  --s-red-ink: #fca5a5;
  --s-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --s-bottom: 20px;
  font-family: "Montserrat", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--s-text);
  -webkit-font-smoothing: antialiased;
}
.sup *,
.sup *::before,
.sup *::after { box-sizing: border-box; }
.sup .ico { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- the key ---------- */
.sup .sup-fab {
  position: fixed;
  z-index: 120;
  right: 20px;
  bottom: var(--s-bottom);
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border: 1px solid var(--s-line-blue);
  border-radius: 4px;
  background: #000;
  color: var(--s-blue-2);
  box-shadow: 0 16px 36px -14px rgba(0, 0, 0, 0.9);
  transition: background-color 110ms, border-color 110ms, color 110ms, transform 110ms;
}
.sup .sup-fab .ico { width: 22px; height: 22px; }
.sup .sup-fab:hover { background: var(--s-wash); border-color: var(--s-blue); color: #fff; }
.sup .sup-fab:active { transform: translateY(1px); }
.sup .sup-fab:focus-visible { outline: 1.5px solid var(--s-blue-2); outline-offset: 3px; }
.sup.is-open .sup-fab { background: var(--s-wash); border-color: var(--s-blue); color: #fff; }
.sup .sup-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  display: grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border: 1px solid var(--s-blue);
  border-radius: 2px;
  background: #000;
  color: var(--s-blue-ink);
  box-shadow: 0 0 0 2px #000;
  font: 600 11px / 1 "JetBrains Mono", "Cascadia Mono", Consolas, ui-monospace, monospace;
}
.sup .sup-badge[hidden] { display: none; }

/* ---------- the panel ---------- */
.sup .sup-panel {
  position: fixed;
  z-index: 121;
  right: 20px;
  bottom: calc(var(--s-bottom) + 64px);
  display: flex;
  flex-direction: column;
  width: min(392px, calc(100vw - 40px));
  height: min(620px, calc(100dvh - var(--s-bottom) - 96px));
  border: 1px solid var(--s-edge-2);
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.94);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 32px 80px -16px rgba(0, 0, 0, 0.92);
  overflow: hidden;
  animation: sup-in 180ms var(--s-ease);
}
.sup .sup-panel[hidden] { display: none; }
@keyframes sup-in { from { opacity: 0; transform: translateY(8px); } }

.sup .sup-head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 58px;
  padding: 8px 10px 8px 16px;
  border-bottom: 1px solid var(--s-edge);
  background: #000;
}
.sup .sup-head .sup-icon:first-child { margin-left: -8px; }
.sup .sup-title { flex: 1; min-width: 0; }
.sup .sup-title h2 {
  margin: 0;
  overflow: hidden;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.01em;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sup .sup-title p {
  margin: 2px 0 0;
  color: var(--s-text-3);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sup .sup-icon {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: none;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 3px;
  background: transparent;
  color: var(--s-text-2);
  cursor: pointer;
  transition: color 110ms, border-color 110ms;
}
.sup .sup-icon:hover { color: #fff; border-color: var(--s-edge-2); }

.sup .sup-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 16px;
  scrollbar-width: thin;
  scrollbar-color: #26272c transparent;
}
.sup .sup-body > * + * { margin-top: 14px; }
.sup .sup-body:has(> .sup-compose) { display: flex; flex-direction: column; }
.sup .sup-body:has(> .sup-compose) > .sup-thread { flex: 1 0 auto; align-content: start; }

.sup .sup-note { margin: 0; color: var(--s-text-2); font-size: 13px; line-height: 1.5; }
.sup .sup-note.is-dim { color: var(--s-text-3); }
.sup .sup-note.is-err { color: var(--s-red-ink); }
.sup .sup-note[hidden] { display: none; }

/* keys */
.sup .sup-key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border: 1px solid var(--s-edge-2);
  border-radius: 3px;
  background: #000;
  color: var(--s-text);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 110ms, border-color 110ms;
}
.sup .sup-key .ico { width: 15px; height: 15px; }
.sup .sup-key:hover { background: #0c0c0f; border-color: var(--s-edge-hi); }
.sup .sup-key-blue { border-color: var(--s-blue-btn); background: var(--s-blue-btn); color: #fff; }
.sup .sup-key-blue:hover { border-color: var(--s-blue-btn-2); background: var(--s-blue-btn-2); }
.sup .sup-key:disabled { opacity: 0.45; cursor: default; }
.sup .sup-key-block { width: 100%; }
.sup .sup-link {
  display: inline-block;
  color: var(--s-blue-2);
  font-size: 13px;
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: rgba(96, 165, 250, 0.4);
  text-underline-offset: 3px;
}
.sup .sup-link:hover { color: #fff; }
.sup .sup-link-btn {
  margin-left: auto;
  padding: 4px 0;
  border: 0;
  background: none;
  color: var(--s-text-2);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: rgba(255, 255, 255, 0.25);
  text-underline-offset: 3px;
  cursor: pointer;
}
.sup .sup-link-btn:hover { color: #fff; }

/* signed out */
.sup .sup-door { display: grid; gap: 12px; justify-items: start; padding: 8px 0; }
.sup .sup-door .sup-door-ico { width: 26px; height: 26px; color: var(--s-blue-2); }
.sup .sup-door h3 { margin: 0; font-size: 18px; font-weight: 680; letter-spacing: -0.02em; }
.sup .sup-door p { margin: 0 0 6px; color: var(--s-text-2); font-size: 13.5px; line-height: 1.55; }
.sup .sup-door .sup-key { width: 100%; }

/* lists */
.sup .sup-cap {
  margin: 22px 0 0;
  color: var(--s-text-3);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.sup .sup-list { margin: 8px 0 0; padding: 0; list-style: none; border-top: 1px solid var(--s-edge); }
.sup .sup-list > li { border-bottom: 1px solid var(--s-edge); }
.sup .sup-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 60px;
  padding: 10px 6px;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background-color 110ms;
}
.sup .sup-row:hover { background: #08080a; }
.sup .sup-row > .ico { color: var(--s-blue-2); }
.sup .sup-row .sup-go { width: 15px; height: 15px; color: var(--s-text-3); }
.sup .sup-row-t { display: grid; gap: 3px; flex: 1; min-width: 0; }
.sup .sup-row-t b { overflow: hidden; font-size: 13.5px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.sup .sup-row-t span { overflow: hidden; color: var(--s-text-3); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.sup .sup-topic .sup-row-t b { white-space: normal; }
.sup .sup-topic .sup-row-t span { white-space: normal; }
.sup .sup-row.is-unread .sup-row-t b { color: #fff; }
/* a ticket row: title and meta get the whole line (and may wrap); the New tag and the status sit under them */
.sup .sup-row:not(.sup-topic) { flex-wrap: wrap; row-gap: 8px; }
.sup .sup-row:not(.sup-topic) .sup-row-t { flex: 1 1 100%; }
.sup .sup-row:not(.sup-topic) .sup-row-t b,
.sup .sup-row:not(.sup-topic) .sup-row-t span { white-space: normal; }
.sup .sup-new {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 6px;
  height: 22px;
  padding: 0 7px;
  border: 1px solid var(--s-line-blue);
  border-radius: 2px;
  color: var(--s-blue-ink);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.sup .sup-new::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--s-blue-2); }

/* annunciator */
.sup .sup-ann {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 7px;
  height: 22px;
  padding: 0 7px;
  border: 1px solid var(--s-edge-2);
  border-radius: 2px;
  color: var(--s-text-2);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}
.sup .sup-ann i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.sup .sup-ann-wait { color: var(--s-blue-ink); border-color: var(--s-line-blue); }
.sup .sup-ann-wait i { background: var(--s-blue-2); }
.sup .sup-ann-ok { color: var(--s-green-ink); border-color: rgba(34, 197, 94, 0.42); }
.sup .sup-ann-ok i { background: var(--s-green); }
.sup .sup-ann-off { color: var(--s-text-3); border-color: var(--s-edge); }

/* the questions */
.sup .sup-q { margin: 0; font-size: 15px; font-weight: 650; letter-spacing: -0.015em; }
.sup .sup-form { display: grid; gap: 18px; }
.sup .sup-fld { display: grid; gap: 7px; min-width: 0; }
.sup .sup-lbl,
.sup .sup-choices legend {
  padding: 0;
  color: var(--s-text);
  font-size: 13px;
  font-weight: 600;
}
.sup .sup-lbl small,
.sup .sup-choices legend small { color: var(--s-text-3); font-size: 11.5px; font-weight: 500; }
.sup .sup-choices { margin: 0; padding: 0; border: 0; min-width: 0; }
.sup .sup-choices legend { margin-bottom: 8px; }
.sup .sup-opts { display: grid; gap: 6px; }
.sup .sup-opt {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--s-edge-2);
  border-radius: 3px;
  color: var(--s-text-2);
  font-size: 13px;
  cursor: pointer;
  transition: border-color 110ms, background-color 110ms, color 110ms;
}
.sup .sup-opt:hover { border-color: var(--s-edge-hi); color: var(--s-text); }
.sup .sup-opt input { width: 15px; height: 15px; margin: 0; accent-color: var(--s-blue); }
.sup .sup-opt:has(input:checked) { border-color: var(--s-line-blue); background: var(--s-wash); color: #fff; }
.sup .sup-opt:has(input:focus-visible) { outline: 1.5px solid var(--s-blue-2); outline-offset: 2px; }
.sup .sup-input {
  width: 100%;
  min-height: 40px;
  padding: 9px 12px;
  border: 1px solid var(--s-edge-2);
  border-radius: 3px;
  background: #000;
  color: var(--s-text);
  font: inherit;
  font-size: 13.5px;
  line-height: 1.5;
  resize: vertical;
  transition: border-color 110ms, box-shadow 110ms;
}
.sup .sup-input::placeholder { color: var(--s-text-3); }
.sup .sup-input:hover { border-color: var(--s-edge-hi); }
.sup .sup-input:focus { outline: none; border-color: var(--s-blue); box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2); }
.sup .sup-input[aria-invalid="true"] { border-color: rgba(239, 68, 68, 0.6); }
.sup .sup-err { margin: 0; color: var(--s-red-ink); font-size: 12.5px; }
.sup .sup-err[hidden] { display: none; }
.sup .sup-privacy { padding: 10px 12px; border: 1px solid var(--s-edge); border-radius: 3px; font-size: 12px; }

/* a conversation */
.sup .sup-tbar { display: flex; align-items: center; gap: 10px; }
.sup .sup-facts { border: 1px solid var(--s-edge); border-radius: 3px; }
.sup .sup-facts summary {
  padding: 9px 12px;
  color: var(--s-text-2);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.sup .sup-facts summary:hover { color: #fff; }
.sup .sup-facts dl { margin: 0; padding: 0 12px 6px; }
.sup .sup-facts dl > div { display: grid; gap: 2px; padding: 8px 0; border-top: 1px solid var(--s-edge); }
.sup .sup-facts dt { color: var(--s-text-3); font-size: 11px; font-weight: 650; letter-spacing: 0.08em; text-transform: uppercase; }
.sup .sup-facts dd { margin: 0; color: var(--s-text); font-size: 13px; overflow-wrap: anywhere; }
.sup .sup-thread { display: grid; gap: 10px; margin: 16px 0 0; padding: 0; list-style: none; }
.sup .sup-msg {
  max-width: 88%;
  padding: 10px 12px;
  border: 1px solid var(--s-edge-2);
  border-radius: 3px;
}
.sup .sup-msg.is-user { justify-self: end; border-color: var(--s-line-blue); background: var(--s-wash); }
.sup .sup-msg.is-staff { justify-self: start; }
.sup .sup-msg-h { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 0 0 4px; }
.sup .sup-msg-h b { color: var(--s-text-3); font-size: 11px; font-weight: 650; letter-spacing: 0.08em; text-transform: uppercase; }
.sup .sup-msg.is-staff .sup-msg-h b { color: var(--s-blue-ink); }
.sup .sup-who { display: inline-flex; align-items: baseline; gap: 6px; min-width: 0; }
.sup .sup-via { color: var(--s-text-3); font-size: 11px; }
.sup .sup-msg-h time { color: var(--s-text-3); font: 500 11px / 1 "JetBrains Mono", "Cascadia Mono", Consolas, ui-monospace, monospace; }
.sup .sup-msg-b { margin: 0; font-size: 13.5px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.sup .sup-compose {
  position: sticky;
  bottom: -16px;
  display: grid;
  gap: 8px;
  margin: 16px -16px -16px;
  margin-top: auto;
  padding: 12px 16px 16px;
  border-top: 1px solid var(--s-edge);
  background: #000;
}
.sup .sup-compose .sup-key { justify-self: end; height: 36px; }

/* ---------- the dashboard: a drawer on the right (UI overhaul 4.4) ----------
   No floating key there (it covered page controls): the head's help key opens the panel, full height, beside the
   page. Phones: the whole screen, above the dock. Esc and the x close it; focus goes back to the help key. */
.sup.sup-drawer .sup-panel {
  top: 0;
  right: 0;
  bottom: 0;
  left: auto;
  width: min(400px, 100vw);
  height: 100dvh;
  border-width: 0 0 0 1px;
  border-radius: 0;
  background: rgba(0, 0, 0, 0.96);
  box-shadow: -32px 0 80px -24px rgba(0, 0, 0, 0.92);
  animation: sup-drawer-in 200ms var(--s-ease);
}
@keyframes sup-drawer-in { from { opacity: 0; transform: translateX(16px); } }
/* (the head lines up with the dashboard's 52px head) */
.sup.sup-drawer .sup-head { min-height: 52px; padding-block: 6px; }
.sup.sup-drawer .sup-body { padding: 16px 20px; }
.sup.sup-drawer .sup-body { padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
@media (max-width: 559px) {
  .sup.sup-drawer .sup-panel { left: 0; width: 100vw; border-width: 0; }
  .sup.sup-drawer .sup-body { padding-inline: 16px; }
}
@media (max-width: 560px) {
  .sup .sup-fab { right: 14px; width: 48px; height: 48px; }
  .sup .sup-panel {
    left: 8px;
    right: 8px;
    width: auto;
    bottom: calc(var(--s-bottom) + 58px);
    height: min(640px, calc(100dvh - var(--s-bottom) - 80px));
  }
}
@media (prefers-reduced-motion: reduce) {
  .sup .sup-panel,
  .sup.sup-drawer .sup-panel { animation: none; }
  .sup * { transition: none !important; }
}

/* ---------- phones & touch (mobile pass) ---------- */
/* the key and the panel clear the home bar and a landscape notch (viewport-fit=cover; env() is 0 elsewhere) */
.sup { --s-bottom: calc(20px + env(safe-area-inset-bottom)); }
.sup .sup-fab { right: max(20px, env(safe-area-inset-right)); }
@media (max-width: 560px) {
  .sup .sup-fab { right: max(14px, env(safe-area-inset-right)); }
}
/* touch: 44px targets; the text link keeps its line and gets a taller hit area */
@media (pointer: coarse) {
  .sup .sup-icon { width: 44px; height: 44px; }
  .sup .sup-key,
  .sup .sup-compose .sup-key,
  .sup .sup-opt { min-height: 44px; }
  .sup .sup-link { padding-block: 12px; margin-block: -12px; }
}
/* phones zoom into a field whose text is under 16px - the message box stays at 16px there */
@media (max-width: 759px), (pointer: coarse) {
  .sup .sup-input { font-size: 16px; }
}
