/* =========================================================================
   ShyzosSupport

   The ShyzosCorp family, tuned for reading. A support desk is read for a
   long time by people who already have a problem, so the palette here is
   quieter than the product sites: the page is lifted off pure black, body
   text sits a step below white, and colour is kept for meaning (who wrote a
   message, what state a ticket is in) rather than decoration.
   ========================================================================= */

:root {
  color-scheme: dark;

  /* Surfaces, darkest to lightest. Close together: depth comes from the
     hairlines and the shadow, not from big jumps in brightness. */
  --ink: #0b0c14;
  --surface: #11131d;
  --surface-2: #161925;
  --surface-3: #1c1f2d;
  --ink-input: #0d0f18;

  /* Three steps of text. None of them pure white, which halates on a dark
     page and is what made long threads tiring. */
  --text: #e7e9f3;
  --text-soft: #b3b8cc;
  --text-muted: #80869c;
  --text-faint: #5f6479;

  --line: rgba(255, 255, 255, 0.07);
  --line-strong: rgba(255, 255, 255, 0.12);
  --line-lit: rgba(255, 255, 255, 0.06);

  /* One accent, a softened version of the brand violet. */
  --accent: #9a85ff;
  --accent-text: #b8a9ff;
  --accent-strong: #6e55e6;
  --accent-wash: rgba(140, 115, 255, 0.1);
  --accent-line: rgba(140, 115, 255, 0.35);
  --focus: 0 0 0 3px rgba(140, 115, 255, 0.28);

  /* Meaning colours, all at the same lightness so none shouts. */
  --amber: #e4b96f;
  --blue: #86b6ec;
  --violet: #b6a1f2;
  --green: #84d1ad;
  --red: #f09aaa;

  --gradient-brand: linear-gradient(120deg, #ff2d9b -12%, #8b3dff 52%, #1d8cf8 112%);
  --gradient-text: linear-gradient(96deg, #f6cf86, #f08fc0 52%, #8fbff2);

  --r-xs: 6px;
  --r-sm: 9px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-pill: 999px;

  --shell: 1120px;
  --reading: 820px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 1px 0 var(--line-lit) inset, 0 10px 30px -14px rgba(0, 0, 0, 0.7);
  --shadow-lg: 0 1px 0 var(--line-lit) inset, 0 24px 60px -24px rgba(0, 0, 0, 0.85);

  --block: clamp(48px, 6vw, 80px);

  --font-display: "Space Grotesk", system-ui, sans-serif;
  --font-body: "Inter", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--ink);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h1, h2, h3 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--text);
}

p { margin: 0; }
a { color: inherit; text-decoration: none; }
code { font-family: var(--font-mono); }

::selection { background: rgba(140, 115, 255, 0.35); color: #fff; }

a:focus-visible, button:focus-visible, summary:focus-visible,
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* One faint wash at the top of the page, and nothing that moves. */
.ambient {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(70% 40% at 15% -5%, rgba(120, 90, 255, 0.075), transparent 70%),
    radial-gradient(50% 35% at 95% 0%, rgba(60, 140, 240, 0.05), transparent 70%);
  pointer-events: none;
}

/* ---------------------------------------------------------------- Header -- */

.site-header {
  position: relative;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  width: min(100% - 40px, var(--shell));
  margin: 12px auto 0;
  padding: 8px 8px 8px 18px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  background: rgba(17, 19, 29, 0.82);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  box-shadow: var(--shadow-md);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-size: 1.02rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}

.brand-mark { display: block; object-fit: contain; }

.brand-accent {
  background: var(--gradient-text);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.site-nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  font-size: 0.88rem;
  color: var(--text-soft);
}

.nav-inline { display: flex; align-items: center; gap: 2px; }

.site-nav a:not(.button) {
  padding: 8px 13px;
  border-radius: var(--r-pill);
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-soft);
  transition: color 0.15s, background 0.15s;
}

.site-nav a:not(.button):hover { color: var(--text); background: rgba(255, 255, 255, 0.05); }

.site-nav .button { min-height: 36px; padding: 0 16px; font-size: 0.84rem; }
.nav-inline .nav-signout { margin-left: 6px; }

/* Who is signed in. */
.nav-user {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 3px 14px 3px 3px;
  line-height: 28px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-soft);
  font-size: 0.82rem;
  font-weight: 500;
  white-space: nowrap;
}

.nav-avatar {
  display: block;
  width: 28px;
  height: 28px;
  flex: none;
  border-radius: 50%;
  object-fit: cover;
  /* A ring as a shadow: a border on a round image lets the corners escape. */
  box-shadow: 0 0 0 1px var(--line-strong);
  overflow: hidden;
}

span.nav-avatar { display: grid; place-items: center; }

.nav-avatar-empty {
  background: linear-gradient(140deg, #7c5cf0, #4f6fe0);
  color: #fff;
  font-family: var(--font-display);
  font-size: 0.78rem;
}

/* The drawer: the same links, inside a disclosure on narrow screens. */
.nav-menu { display: none; position: relative; }

.nav-menu summary {
  display: grid;
  place-content: center;
  gap: 4px;
  width: 40px;
  height: 40px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  list-style: none;
}

.nav-menu summary::-webkit-details-marker { display: none; }

.nav-menu summary span {
  display: block;
  width: 16px;
  height: 1.5px;
  border-radius: 2px;
  background: var(--text);
  transition: transform 0.25s var(--ease), opacity 0.25s var(--ease);
}

.nav-menu[open] summary span:nth-child(1) { transform: translateY(5.5px) rotate(45deg); }
.nav-menu[open] summary span:nth-child(2) { opacity: 0; }
.nav-menu[open] summary span:nth-child(3) { transform: translateY(-5.5px) rotate(-45deg); }

.nav-drawer {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  z-index: 60;
  display: grid;
  gap: 2px;
  min-width: 230px;
  padding: 8px;
  border-radius: var(--r-md);
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  box-shadow: var(--shadow-lg);
}

.site-nav .nav-drawer a:not(.button) {
  display: block;
  padding: 11px 14px;
  border-radius: var(--r-sm);
  font-size: 0.92rem;
}

.nav-drawer .nav-signout {
  display: block;
  margin-top: 6px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.nav-drawer .nav-signout .button { width: 100%; }

.site-nav a, .site-nav .button { white-space: nowrap; }

@media (max-width: 860px) {
  .nav-inline { display: none; }
  .nav-menu { display: block; }
  .nav-user { display: none; }
}

/* The staff header carries seven links: it folds into the menu sooner. */
@media (max-width: 1100px) {
  .site-nav:has(.nav-user) .nav-inline { display: none; }
  .site-nav:has(.nav-user) .nav-menu { display: block; }
}

/* ------------------------------------------------------------- Structure -- */

/*
 * Two widths. A page that is mostly one column of words (the forms, a
 * thread) stays at a reading width; a page with a list, numbers or a side
 * column gets the full shell.
 */
main {
  width: min(100% - 40px, var(--reading));
  margin: 0 auto;
  padding: 48px 0 72px;
}

main:has(.split),
main:has(.stat-grid),
main:has(.ticket-list),
main:has(.tabs) { width: min(100% - 40px, var(--shell)); }

main.narrow { width: min(100% - 40px, 600px); }

/* On a public page at reading width, the header and footer line up with it
   rather than overhanging the column on both sides. */
body:not(:has(.split, .stat-grid, .ticket-list, .tabs, .legal)) .site-header:not(:has(.nav-user)),
body:not(:has(.split, .stat-grid, .ticket-list, .tabs, .legal)) .site-footer {
  width: min(100% - 40px, calc(var(--reading) + 80px));
}

.head { display: grid; gap: 10px; margin-bottom: 28px; }
.head h1 { font-size: clamp(1.7rem, 3vw, 2.15rem); text-wrap: balance; }

/* The line under a ticket's title: status, reference, date. Inline, so the
   words after the chip wrap as words rather than as one block. */
.head .lead .status { margin-right: 8px; vertical-align: 1px; }
.head .lead .reference { margin-right: 2px; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.eyebrow i { width: 6px; height: 6px; border-radius: 50%; background: var(--gradient-brand); opacity: 0.85; }
.eyebrow a { color: var(--text-soft); transition: color 0.15s; }
.eyebrow a:hover { color: var(--text); }

.lead { max-width: 64ch; color: var(--text-soft); font-size: 1.02rem; line-height: 1.65; }

.panel {
  position: relative;
  padding: 26px;
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.panel > p:only-child { color: var(--text-soft); }
.panel h2 { font-size: 1.05rem; letter-spacing: -0.01em; }

.text-link {
  color: var(--accent-text);
  text-decoration: underline;
  text-decoration-color: rgba(184, 169, 255, 0.4);
  text-underline-offset: 3px;
}

.text-link:hover { text-decoration-color: currentColor; }

/* ---------------------------------------------------------------- Fields -- */

.form-stack { display: grid; gap: 20px; }
.field { display: grid; gap: 8px; }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }

label { font-size: 0.86rem; font-weight: 500; color: var(--text-soft); }

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 11px 14px;
  appearance: none;
  -webkit-appearance: none;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-strong);
  background: var(--ink-input);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.95rem;
  line-height: 1.5;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.field input::placeholder,
.field textarea::placeholder { color: var(--text-faint); }

.field input:hover,
.field select:hover,
.field textarea:hover { border-color: rgba(255, 255, 255, 0.17); }

.field textarea { min-height: 180px; resize: vertical; line-height: 1.65; }

.field select {
  background-image:
    linear-gradient(45deg, transparent 50%, var(--text-muted) 50%),
    linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
  background-position: calc(100% - 19px) 52%, calc(100% - 14px) 52%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 40px;
  cursor: pointer;
}

.field select option { background: var(--surface-2); color: var(--text); }

.field input:focus-visible,
.field select:focus-visible,
.field textarea:focus-visible {
  outline: none;
  border-color: var(--accent-line);
  box-shadow: var(--focus);
}

.field input[type="file"] {
  padding: 10px 12px;
  border-style: dashed;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.86rem;
  cursor: pointer;
}

.field input[type="file"]::file-selector-button {
  margin-right: 12px;
  padding: 6px 12px;
  border-radius: var(--r-xs);
  border: 1px solid var(--line-strong);
  background: var(--surface-3);
  color: var(--text);
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
}

.field-optional {
  margin-left: 6px;
  font-size: 0.74rem;
  font-weight: 400;
  color: var(--text-muted);
}

.hint { font-size: 0.83rem; line-height: 1.55; color: var(--text-muted); }

.hint code,
.field code {
  padding: 1px 6px;
  border-radius: var(--r-xs);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.78rem;
  color: var(--text-soft);
}

/* Messages after a form was sent. */
.notice,
.error {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  padding: 12px 16px;
  border-radius: var(--r-md);
  font-size: 0.92rem;
  line-height: 1.5;
}

.notice { border: 1px solid rgba(132, 209, 173, 0.25); background: rgba(132, 209, 173, 0.07); color: #b7e6cf; }
.error { border: 1px solid rgba(240, 154, 170, 0.28); background: rgba(240, 154, 170, 0.07); color: #f5c1cb; }

.warn { color: var(--red); }

/* --------------------------------------------------------------- Buttons -- */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 20px;
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
}

/*
 * The main action is a solid, slightly lit violet. The full magenta-to-blue
 * gradient is the brand's loudest thing; on a page with a form on it, it
 * pulled the eye away from the form.
 */
.button-primary {
  border-color: rgba(160, 140, 255, 0.35);
  background: linear-gradient(180deg, #7b62f0, #6549dc);
  color: #fff;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.18) inset, 0 6px 18px -8px rgba(110, 85, 230, 0.7);
}

.button-primary:hover { background: linear-gradient(180deg, #866ef4, #6f54e4); }
.button-primary:active { background: #6046d4; }

.button-quiet { border-color: var(--line-strong); background: rgba(255, 255, 255, 0.045); color: var(--text); }
.button-quiet:hover { background: rgba(255, 255, 255, 0.08); border-color: rgba(255, 255, 255, 0.18); }

.button-ghost { border-color: var(--line); background: transparent; color: var(--text-soft); }
.button-ghost:hover { color: var(--text); border-color: var(--line-strong); background: rgba(255, 255, 255, 0.03); }

.button-block { width: 100%; }

.inline-form { display: inline-flex; gap: 8px; margin: 0; }

/*
 * A deletion asks first. "Delete" only opens the question; the form that
 * deletes is inside it. A <details>, so it works without JavaScript.
 */
.confirm-delete { position: relative; }
.confirm-delete > summary { list-style: none; cursor: pointer; }
.confirm-delete > summary::-webkit-details-marker { display: none; }
.confirm-delete > summary::marker { content: ""; }
.confirm-delete[open] > summary { color: var(--text); border-color: var(--line-strong); }
.confirm-delete-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 20;
  display: grid;
  gap: 12px;
  width: min(280px, calc(100vw - 32px));
  margin: 0;
  padding: 14px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface-2, #15171c);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
  text-align: left;
}
.confirm-delete-panel p { margin: 0; color: var(--text-soft); font-size: 0.86rem; line-height: 1.5; }
.button-danger {
  border-color: rgba(240, 154, 170, 0.45);
  background: rgba(240, 154, 170, 0.12);
  color: var(--red);
}
.button-danger:hover { border-color: var(--red); background: rgba(240, 154, 170, 0.2); }

/* A row of buttons, or the product picker. */
.picker { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }

/* A radio card: the product picker. */
.choice { position: relative; flex: 1 1 200px; }
.choice input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.choice span {
  display: grid;
  gap: 3px;
  height: 100%;
  padding: 13px 16px;
  border-radius: var(--r-md);
  border: 1px solid var(--line-strong);
  background: var(--ink-input);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.choice b { font-size: 0.92rem; font-weight: 600; color: var(--text); }
.choice small { font-size: 0.79rem; line-height: 1.45; color: var(--text-muted); }
.choice:hover span { border-color: rgba(255, 255, 255, 0.18); }

.choice input:checked + span {
  border-color: var(--accent-line);
  background: var(--accent-wash);
  box-shadow: 0 0 0 1px var(--accent-line) inset;
}

.choice input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* The ticket link, printed once after opening. */
.key-reveal {
  padding: 14px 16px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-strong);
  background: var(--ink-input);
  font-family: var(--font-mono);
  font-size: 0.86rem;
  color: var(--accent-text);
  overflow-wrap: anywhere;
}

/* ------------------------------------------------------- Status, refs -- */

.status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 3px 11px 3px 9px;
  border-radius: var(--r-pill);
  border: 1px solid;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.5;
  white-space: nowrap;
}

.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.status-open { color: var(--amber); border-color: rgba(228, 185, 111, 0.28); background: rgba(228, 185, 111, 0.08); }
.status-answered { color: var(--blue); border-color: rgba(134, 182, 236, 0.28); background: rgba(134, 182, 236, 0.08); }
.status-waiting { color: var(--violet); border-color: rgba(182, 161, 242, 0.28); background: rgba(182, 161, 242, 0.08); }
.status-resolved { color: var(--green); border-color: rgba(132, 209, 173, 0.25); background: rgba(132, 209, 173, 0.07); }

.reference {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

/* ----------------------------------------------------------- Ticket list -- */

.ticket-list { display: grid; gap: 8px; }

.ticket-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  padding: 16px 20px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--surface);
  transition: border-color 0.15s, background 0.15s;
}

a.ticket-row:hover { border-color: var(--line-strong); background: var(--surface-2); }

.ticket-subject {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
  color: var(--text);
}

.ticket-subject a:hover { color: var(--accent-text); }

.ticket-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 0;
  margin-top: 5px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* A quiet dot between facts, instead of a wide gap that reads as columns. */
.ticket-meta > span + span::before {
  content: "·";
  margin: 0 9px;
  color: var(--text-faint);
}

.ticket-side { display: grid; justify-items: end; gap: 6px; }
.ticket-side .ticket-meta { margin-top: 0; font-size: 0.78rem; }
.ticket-side .inline-form { display: inline-flex; }
.ticket-side:has(.button) { display: flex; align-items: center; gap: 8px; }
.ticket-side .button { min-height: 34px; padding: 0 14px; font-size: 0.82rem; }

.panel .ticket-row { background: var(--surface-2); }

/* Somebody joining or losing the desk, among mostly routine lines. */
.row-notable { box-shadow: 2px 0 0 var(--accent) inset; }

/* Somebody whose role no longer qualifies. */
.row-off { opacity: 0.55; }

.agent-row { display: flex; align-items: center; gap: 14px; min-width: 0; }

.row-avatar {
  display: block;
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 0 0 1px var(--line-strong);
  background: var(--surface-3);
}

span.row-avatar-empty {
  display: grid;
  place-items: center;
  background: linear-gradient(140deg, #7c5cf0, #4f6fe0);
  color: #fff;
  font-family: var(--font-display);
  font-size: 0.92rem;
}

.empty {
  padding: 44px 24px;
  border-radius: var(--r-lg);
  border: 1px dashed var(--line-strong);
  text-align: center;
  color: var(--text-muted);
}

/* ----------------------------------------------------------------- Tabs -- */

.tabs {
  display: flex;
  gap: 2px;
  width: fit-content;
  max-width: 100%;
  margin-bottom: 20px;
  padding: 4px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--surface);
  overflow-x: auto;
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar { display: none; }

.tab {
  flex: none;
  padding: 7px 14px;
  border-radius: var(--r-sm);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
  transition: color 0.15s, background 0.15s;
}

.tab:hover { color: var(--text); }

.tab[aria-current="page"] {
  color: var(--text);
  background: var(--surface-3);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.05) inset, var(--shadow-sm);
}

/* ---------------------------------------------------------------- Stats -- */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.stat {
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 6px;
  padding: 18px 20px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--surface);
}

.stat b {
  order: 2;
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.stat span {
  order: 1;
  font-size: 0.74rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* --------------------------------------------------------------- Search -- */

.search { display: flex; gap: 8px; margin-bottom: 18px; }

.search input {
  flex: 1;
  min-width: 0;
  padding: 10px 14px 10px 40px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line-strong);
  /* A drawn magnifier, so the field says what it is before anything is typed. */
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%2380869c' stroke-width='1.6' stroke-linecap='round'%3E%3Ccircle cx='7' cy='7' r='5'/%3E%3Cpath d='m11 11 3.5 3.5'/%3E%3C/svg%3E")
    no-repeat 15px 50%,
    var(--ink-input);
  color: var(--text);
  font: inherit;
  font-size: 0.92rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.search input::placeholder { color: var(--text-faint); }

.search input:focus {
  outline: none;
  border-color: var(--accent-line);
  box-shadow: var(--focus);
}

.search-excerpt {
  margin-top: 8px;
  padding-left: 10px;
  border-left: 2px solid var(--line-strong);
  font-size: 0.84rem;
  line-height: 1.55;
  color: var(--text-muted);
}

/* ---------------------------------------------------------------- Thread -- */

.thread { display: grid; gap: 12px; margin: 0 0 20px; }

/*
 * One card per message. Who wrote it is told by a narrow bar down the left
 * and a faint wash, not by a coloured box: in a long thread the eye should
 * land on the words, and find the desk's answers without hunting.
 */
.message {
  position: relative;
  padding: 18px 22px 20px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--surface);
}

.message-staff {
  border-color: rgba(140, 115, 255, 0.2);
  background: linear-gradient(180deg, rgba(140, 115, 255, 0.06), rgba(140, 115, 255, 0.02)), var(--surface);
  box-shadow: 3px 0 0 rgba(140, 115, 255, 0.6) inset;
}

.message-internal {
  border-style: dashed;
  border-color: rgba(228, 185, 111, 0.3);
  background: rgba(228, 185, 111, 0.04);
  box-shadow: 3px 0 0 rgba(228, 185, 111, 0.55) inset;
}

.message-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 12px;
  margin-bottom: 12px;
  padding-bottom: 11px;
  border-bottom: 1px solid var(--line);
}

.message-who {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
}

.message-staff .message-who { color: var(--accent-text); }

.message-when { font-size: 0.78rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }

/* Written by people we do not know: it is text, and stays text. */
.message-body {
  max-width: 72ch;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 0.96rem;
  line-height: 1.7;
  color: #d3d6e4;
}

/*
 * A message rendered from Markdown. The renderer writes block tags, so the
 * line breaks come from them rather than from pre-wrap; only code keeps its
 * spacing as typed.
 */
.markdown { white-space: normal; }
.markdown > :first-child { margin-top: 0; }
.markdown > :last-child { margin-bottom: 0; }
.markdown p { margin: 0 0 0.85em; }

.markdown h3, .markdown h4, .markdown h5, .markdown h6 {
  margin: 1.3em 0 0.5em;
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.3;
  color: var(--text);
}

.markdown h3 { font-size: 1.15rem; }
.markdown h4 { font-size: 1.04rem; }
.markdown h5, .markdown h6 { font-size: 0.96rem; }

.markdown strong { font-weight: 600; color: var(--text); }
.markdown del { color: var(--text-muted); }

.markdown a {
  color: var(--accent-text);
  text-decoration: underline;
  text-decoration-color: rgba(184, 169, 255, 0.4);
  text-underline-offset: 3px;
  overflow-wrap: anywhere;
}

.markdown a:hover { text-decoration-color: currentColor; }

.markdown ul, .markdown ol { margin: 0 0 0.85em; padding-left: 1.4em; }
.markdown li { margin: 0.2em 0; padding-left: 0.2em; }
.markdown li::marker { color: var(--text-muted); }

.markdown blockquote {
  margin: 0 0 0.85em;
  padding: 2px 0 2px 14px;
  border-left: 2px solid var(--line-strong);
  color: var(--text-soft);
}

.markdown code {
  padding: 1px 6px;
  border-radius: var(--r-xs);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.045);
  font-size: 0.86em;
  color: var(--text);
}

.markdown pre {
  margin: 0 0 0.85em;
  padding: 12px 14px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--ink-input);
  overflow-x: auto;
  white-space: pre;
  line-height: 1.55;
}

.markdown pre code { padding: 0; border: 0; background: none; font-size: 0.84rem; }

.markdown hr { margin: 1.2em 0; border: 0; border-top: 1px solid var(--line-strong); }

/* The hint and the preview button under a message box. */
.md-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px 14px;
}

.md-tools .hint { flex: 1 1 260px; }
.md-tools .chip { flex: none; }

.md-preview {
  max-width: none;
  min-height: 72px;
  padding: 14px 16px;
  border-radius: var(--r-sm);
  border: 1px dashed var(--line-strong);
  background: rgba(255, 255, 255, 0.015);
}

.md-preview[hidden] { display: none; }
.md-preview.is-empty { color: var(--text-faint); font-style: italic; }

.tag-internal {
  padding: 1px 8px;
  border-radius: var(--r-pill);
  border: 1px solid rgba(228, 185, 111, 0.35);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--amber);
}

/* The requester's way out of a thread: quiet, under the reply box. */
.close-thread {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.close-thread .hint { margin: 0; flex: 1 1 260px; }

/* -------------------------------------------------------- Attachments -- */

.attachments { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }

.attachment {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 100%;
  padding: 8px 12px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-strong);
  background: var(--ink-input);
  font-size: 0.84rem;
  color: var(--text);
  transition: border-color 0.15s, background 0.15s;
}

.attachment:hover { border-color: rgba(255, 255, 255, 0.2); background: var(--surface-2); }
.attachment small { margin-left: 4px; color: var(--text-muted); }

.attachment-mark {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: var(--r-xs);
  background: var(--surface-3);
  color: var(--text-soft);
}

.attachment-image { flex-direction: column; align-items: flex-start; gap: 8px; padding: 8px; }

.attachment-image img {
  display: block;
  max-width: 260px;
  max-height: 200px;
  width: auto;
  height: auto;
  border-radius: var(--r-xs);
  background: var(--ink);
}

/* --------------------------------------------------- Ticket, staff side -- */

.split { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; align-items: start; }

.side { display: grid; gap: 14px; }
.side .panel { padding: 20px; }
.side .form-stack { gap: 12px; }
.side .form-stack .button { width: 100%; }
.side dl { display: grid; gap: 14px; margin: 0; }
.side dl > div + div { padding-top: 14px; border-top: 1px solid var(--line); }

.side dt {
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.side dd { margin: 4px 0 0; font-size: 0.92rem; overflow-wrap: anywhere; }

/* Saved replies, offered as chips under the reply box. */
.saved { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

.saved-label { margin-right: 4px; font-size: 0.8rem; color: var(--text-muted); }

.chip {
  padding: 6px 13px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-soft);
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.chip:hover { border-color: var(--accent-line); background: var(--accent-wash); color: var(--text); }

/* A region that just replaced itself: one pass of a lit edge. */
[data-live-region].live-arrived { animation: live-arrived 1.2s ease-out; }

@keyframes live-arrived {
  from { box-shadow: 0 0 0 1px rgba(140, 115, 255, 0.55); }
  to { box-shadow: 0 0 0 1px rgba(140, 115, 255, 0); }
}

/* ---------------------------------------------------------------- Footer -- */

.site-footer {
  width: min(100% - 40px, var(--shell));
  margin: 24px auto 0;
  padding: 44px 0 36px;
  border-top: 1px solid var(--line);
  font-size: 0.86rem;
  color: var(--text-muted);
}

.footer-top {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(0, 2fr);
  gap: 40px;
  padding-bottom: 32px;
}

.footer-brand { display: grid; gap: 12px; align-content: start; justify-items: start; }
.footer-brand p { max-width: 36ch; font-size: 0.85rem; line-height: 1.6; }

.footer-links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 28px;
}

.footer-links > div { display: grid; gap: 8px; align-content: start; }

.footer-links h3 {
  margin-bottom: 4px;
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-soft);
}

.footer-links a {
  font-size: 0.86rem;
  color: var(--text-muted);
  transition: color 0.15s;
  overflow-wrap: anywhere;
}

.footer-links a:hover { color: var(--text); }

.footer-note { margin-top: -4px; font-size: 0.75rem; color: var(--text-faint); }

.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  font-size: 0.78rem;
}

.footer-bottom a { color: var(--text-soft); text-decoration: underline; text-underline-offset: 3px; }
.footer-bottom a:hover { color: var(--text); }

/* The language picker, which opens upward from the bottom of the page. */
.lang-picker { position: relative; }

.lang-picker > summary {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  font-size: 0.78rem;
  color: var(--text-soft);
  cursor: pointer;
  list-style: none;
  transition: color 0.15s, border-color 0.15s;
}

.lang-picker > summary::-webkit-details-marker { display: none; }
.lang-picker > summary::marker { content: ""; }
.lang-picker > summary:hover { color: var(--text); border-color: var(--line-strong); }

.lang-picker > summary::after {
  content: "";
  width: 5px;
  height: 5px;
  margin-left: 1px;
  border-right: 1.4px solid currentColor;
  border-bottom: 1.4px solid currentColor;
  transform: rotate(-135deg) translate(-2px, -2px);
  transition: transform 0.15s ease;
}

.lang-picker[open] > summary::after { transform: rotate(45deg) translate(-1px, -1px); }
.lang-picker .globe { flex: none; opacity: 0.8; }

.lang-menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  z-index: 20;
  display: grid;
  gap: 2px;
  min-width: 190px;
  padding: 6px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--surface-2);
  box-shadow: var(--shadow-lg);
}

.lang-choice {
  padding: 8px 10px;
  border: 0;
  border-radius: var(--r-xs);
  background: transparent;
  font: inherit;
  font-size: 0.82rem;
  text-align: left;
  color: var(--text-soft);
  cursor: pointer;
}

.lang-choice:hover { background: rgba(255, 255, 255, 0.05); color: var(--text); }
.lang-choice.is-current { color: var(--text); cursor: default; font-weight: 600; }

.lang-note {
  margin-top: 4px;
  padding: 6px 10px 2px;
  border-top: 1px solid var(--line);
  font-size: 0.72rem;
  line-height: 1.5;
  color: var(--text-faint);
}

/* ---------------------------------------------------- Legal documents -- */

.legal {
  width: min(100% - 40px, var(--shell));
  margin: 0 auto;
  padding: 48px 0 var(--block);
}

.legal-head {
  display: grid;
  gap: 12px;
  justify-items: start;
  padding-bottom: 26px;
  margin-bottom: 34px;
  border-bottom: 1px solid var(--line);
}

.legal-head h1 { font-size: clamp(1.75rem, 3vw, 2.2rem); }
.legal-updated { font-size: 0.78rem; color: var(--text-muted); }

.legal-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  margin-top: 6px;
  padding: 4px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--surface);
}

.legal-switch a {
  padding: 7px 14px;
  border-radius: var(--r-sm);
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: color 0.15s, background 0.15s;
}

.legal-switch a:hover { color: var(--text); }
.legal-switch a[aria-current="page"] { color: var(--text); background: var(--surface-3); box-shadow: var(--shadow-sm); }

.legal-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 48px;
  align-items: start;
}

.legal-toc { position: sticky; top: 92px; display: grid; gap: 10px; }

.legal-toc-title {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.legal-toc ol { display: grid; gap: 1px; margin: 0; padding: 0; list-style: none; }

.legal-toc a {
  display: block;
  padding: 6px 12px;
  border-left: 2px solid var(--line);
  font-size: 0.83rem;
  line-height: 1.4;
  color: var(--text-muted);
  transition: color 0.15s, border-color 0.15s;
}

.legal-toc a:hover { color: var(--text); border-color: var(--accent); }

.legal-body { max-width: 70ch; }
.legal-section { scroll-margin-top: 96px; }

.legal-section + .legal-section {
  margin-top: 36px;
  padding-top: 32px;
  border-top: 1px solid var(--line);
}

.legal-section > h2 { margin: 0 0 14px; font-size: 1.18rem; line-height: 1.35; }

.legal-numbered { counter-reset: clause; }

.legal-numbered .legal-section > h2 {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  align-items: baseline;
  counter-increment: clause;
}

.legal-numbered .legal-section > h2::before {
  content: counter(clause) ".";
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 400;
  color: var(--accent);
}

.legal-prose { color: var(--text-soft); line-height: 1.75; }
.legal-prose p { margin: 0 0 1em; }
.legal-prose > *:last-child { margin-bottom: 0; }
.legal-prose strong { color: var(--text); font-weight: 600; }

.legal-prose a,
.legal-foot a,
.contact-list dt a {
  color: var(--accent-text);
  text-decoration: underline;
  text-decoration-color: rgba(184, 169, 255, 0.4);
  text-underline-offset: 3px;
}

.legal-prose a:hover,
.legal-foot a:hover,
.contact-list dt a:hover { text-decoration-color: currentColor; }

.legal-prose code {
  padding: 2px 6px;
  border-radius: var(--r-xs);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.85em;
  color: var(--text);
}

.legal-prose table {
  width: 100%;
  margin: 0 0 1em;
  font-size: 0.87rem;
  line-height: 1.55;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
}

.legal-prose th,
.legal-prose td {
  padding: 11px 14px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
}

.legal-prose th {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: var(--surface);
}

.legal-prose tbody tr:last-child td { border-bottom: 0; }
.legal-prose td:first-child { width: 38%; color: var(--text); }

.callout {
  display: grid;
  gap: 4px;
  margin: 0 0 1em;
  padding: 14px 18px;
  border-radius: var(--r-md);
  border: 1px solid;
  font-size: 0.92rem;
  line-height: 1.6;
}

.callout strong { color: var(--text); }
.callout span { color: var(--text-soft); }

.callout-note {
  border-color: rgba(140, 115, 255, 0.22);
  background: rgba(140, 115, 255, 0.06);
  box-shadow: 3px 0 0 var(--accent) inset;
}

.callout-warn {
  border-color: rgba(240, 154, 170, 0.22);
  background: rgba(240, 154, 170, 0.06);
  box-shadow: 3px 0 0 var(--red) inset;
}

.callout-warn strong { color: #f5c1cb; }

.contact-list { display: grid; gap: 10px; margin: 0; }

.contact-list div {
  display: grid;
  gap: 2px;
  padding: 12px 16px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--surface);
}

.contact-list dt { margin: 0; font-size: 0.9rem; font-weight: 600; }
.contact-list dd { margin: 0; font-size: 0.84rem; color: var(--text-muted); }

.legal-foot {
  margin-top: 36px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  font-size: 0.86rem;
  color: var(--text-muted);
}

/* ------------------------------------------------------------ Narrower -- */

@media (max-width: 900px) {
  .legal-layout { grid-template-columns: minmax(0, 1fr); gap: 24px; }

  .legal-toc {
    position: static;
    padding: 14px 16px;
    border-radius: var(--r-md);
    border: 1px solid var(--line);
    background: var(--surface);
  }

  .legal-toc ol { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
  .legal-toc a { padding-left: 0; border-left: 0; }
  .legal-body { max-width: none; }
}

@media (max-width: 860px) {
  .split { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 760px) {
  .footer-top { grid-template-columns: minmax(0, 1fr); gap: 30px; }
}

@media (max-width: 640px) {
  main { width: min(100% - 32px, var(--shell)); padding: 32px 0 56px; }
  main:has(.split), main:has(.stat-grid), main:has(.ticket-list), main:has(.tabs),
  main.narrow { width: min(100% - 32px, var(--shell)); }
  .legal { width: min(100% - 32px, var(--shell)); padding-top: 32px; }
  .site-footer { width: min(100% - 32px, var(--shell)); }

  /* The header: one row, the wordmark gives way first. */
  .site-header { width: min(100% - 24px, var(--shell)); margin-top: 8px; gap: 12px; padding: 6px 6px 6px 14px; }
  .site-nav { flex-wrap: nowrap; }
  .brand { min-width: 0; }
  .brand > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  .panel { padding: 20px 18px; border-radius: var(--r-md); }
  .message { padding: 16px 16px 18px; }
  .message-body { font-size: 0.95rem; }

  .ticket-row { grid-template-columns: minmax(0, 1fr); gap: 10px; padding: 14px 16px; }
  .ticket-side { display: flex; align-items: center; justify-content: space-between; }
  .ticket-subject { white-space: normal; }

  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat { padding: 14px 16px; }
  .stat b { font-size: 1.45rem; }

  .search .button { padding: 0 16px; }

  /* Under 16px, iOS Safari zooms the page when a field takes focus. */
  .field input,
  .field select,
  .field textarea,
  .search input { font-size: 16px; }

  /* Finger-sized footer links. */
  .footer-links a { display: block; padding: 11px 0; }
  .footer-links > div { gap: 0; }
  .footer-brand .brand { padding: 6px 0; }

  /* A form's own button spans the form, like a phone keyboard's. */
  .form-stack > .button,
  .form-stack > button,
  .form-stack > .picker > .button { width: 100%; }

  .legal-prose table { display: block; overflow-x: auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ------------------------------------------------------------- Skip link -- */

/*
 * The first thing on every page, for a keyboard: Tab once, Enter, and focus
 * is past the header, on either side of the desk. Off screen until it has
 * focus, then in the top-left corner above everything, with no motion to wait
 * for. Above the header's own layers, which stop at 60.
 */
.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 1000;
  padding: 10px 16px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--surface-3);
  color: var(--text);
  font: 600 14px/1.2 var(--font-body);
  text-decoration: none;
  transform: translateY(calc(-100% - 24px));
}

.skip-link:focus,
.skip-link:focus-visible {
  transform: none;
}
