/* TAC//PAC manager - one stylesheet, no framework, no build step.
 *
 * TWO TYPEFACES, ON PURPOSE. Everything used to be monospace, which made a
 * management page read like a log dump: no hierarchy, every word the same
 * weight. Prose and chrome are now the system UI face; monospace is kept for
 * the things that are actually data - ids, document keys, counts, JSON - so
 * the eye can tell a label from a value without reading either.
 */

:root {
  /* Surfaces, darkest to lightest. Three is enough to build depth with. */
  --ground:   #0b0e11;
  --well:     #070a0c;   /* inputs, code blocks - the recess behind a surface */
  --panel:    #12161b;
  --raise:    #171c22;
  --line:     #242b33;
  --line-dim: rgba(255, 255, 255, .06);

  --ink:   #e3e9ef;
  --dim:   #8b97a3;
  --faint: #5c6773;

  /* Phosphor green is the unit's colour; it stays the accent. */
  --accent:     #93cf72;
  --accent-dim: rgba(147, 207, 114, .13);
  --on-accent:  #0b0e11;

  --hot:      #e4574a;
  --hot-dim:  rgba(228, 87, 74, .12);
  --hot-ink:  #f4c4bf;   /* readable text ON a hot-dim background */
  --warn:     #d9a441;
  --steam:    #66c0f4;

  --ui: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, "DejaVu Sans Mono", monospace;

  --s1: .25rem;  --s2: .5rem;   --s3: .75rem;
  --s4: 1rem;    --s5: 1.5rem;  --s6: 2rem;   --s7: 3rem;

  --r: 4px;

  /* Logo sizes, overridden per unit from the branding page. */
  --logo-login: 96px;
  --logo-bar: 26px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font: 15px/1.55 var(--ui);
  -webkit-font-smoothing: antialiased;
}

/* ---- the bar ------------------------------------------------------------ */

.bar {
  display: flex; align-items: center; gap: var(--s5);
  padding: var(--s3) var(--s5);
  background: linear-gradient(var(--panel), var(--ground));
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
  position: sticky; top: 0; z-index: 10;
}
.brand {
  font-weight: 700; letter-spacing: .1em; font-size: .9rem;
  text-transform: uppercase; white-space: nowrap;
  display: flex; align-items: center;
}
.brand .logo { height: var(--logo-bar); width: auto; max-width: 14rem; object-fit: contain; }
.brand .dim { letter-spacing: .06em; font-weight: 400; }

.bar nav { display: flex; gap: var(--s5); flex: 1; flex-wrap: wrap; align-items: center; }
.bar nav a {
  color: var(--dim); text-decoration: none;
  font-size: .82rem; text-transform: uppercase; letter-spacing: .07em;
  padding: var(--s2) 0; position: relative;
}
.bar nav a:hover { color: var(--ink); }
/* The active marker sits under the text rather than adding a border to the
   box, so switching pages never shifts the row by a pixel. */
.bar nav a.on { color: var(--accent); }
.bar nav a.on::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0;
  height: 2px; background: var(--accent);
}
.bar nav a.right { margin-left: auto; }
.bar nav .who {
  margin-left: auto; font-size: .78rem; padding-right: var(--s4);
  font-family: var(--mono); color: var(--faint);
}
.bar nav .who + a.right { margin-left: 0; }

/* ---- page --------------------------------------------------------------- */

main { padding: var(--s5); max-width: 1200px; }

h1 {
  font-size: 1.35rem; letter-spacing: .04em; font-weight: 600;
  margin: var(--s2) 0 var(--s5); padding-bottom: var(--s3);
  border-bottom: 1px solid var(--line);
}
h2 {
  font-size: .78rem; letter-spacing: .12em; text-transform: uppercase;
  margin: var(--s6) 0 var(--s3); color: var(--accent); font-weight: 600;
}
h3 {
  font-size: .74rem; letter-spacing: .1em; text-transform: uppercase;
  color: var(--dim); font-weight: 600;
}

a { color: var(--accent); text-decoration-color: var(--accent-dim); text-underline-offset: 2px; }
a:hover { text-decoration-color: currentColor; }

code {
  font-family: var(--mono); font-size: .86em;
  color: var(--ink); background: rgba(255, 255, 255, .05);
  padding: .1em .4em; border-radius: 3px;
}
pre {
  font-family: var(--mono); font-size: .82rem;
  background: var(--well); padding: var(--s4); overflow-x: auto;
  border: 1px solid var(--line); border-radius: var(--r);
}
.dim { color: var(--dim); }
p { max-width: 68ch; }

/* ---- stat tiles --------------------------------------------------------- */

.tiles {
  display: grid; gap: var(--s3); margin-bottom: var(--s5);
  grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr));
}
.tile {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r); padding: var(--s4);
  color: var(--dim); text-transform: uppercase;
  font-size: .68rem; letter-spacing: .1em;
  position: relative; overflow: hidden;
}
/* A hairline of accent along the top edge - enough to tie the row together
   without four solid blocks of green shouting at the reader. */
.tile::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 2px;
  background: linear-gradient(90deg, var(--accent), transparent 70%);
  opacity: .5;
}
.tile .n {
  display: block; font-family: var(--mono); font-size: 2rem; line-height: 1.1;
  color: var(--ink); letter-spacing: -.02em; font-variant-numeric: tabular-nums;
  margin-bottom: var(--s1);
}

/* ---- tables ------------------------------------------------------------- */

table { border-collapse: collapse; width: 100%; margin-bottom: var(--s5); }
th, td {
  text-align: left; padding: var(--s3); vertical-align: top;
  border-bottom: 1px solid var(--line-dim);
}
th {
  color: var(--faint); font-weight: 600; text-transform: uppercase;
  font-size: .68rem; letter-spacing: .1em;
  border-bottom: 1px solid var(--line);
}
td code, td .mono { font-family: var(--mono); }

table.kv th { width: 13rem; color: var(--dim); text-transform: none;
              letter-spacing: 0; font-size: .85rem; font-weight: 400; }
table.kv tr:last-child th, table.kv tr:last-child td { border-bottom: 0; }

table.grid tbody tr:hover { background: var(--raise); }
/* Wide tables scroll inside themselves rather than pushing the page sideways. */
table.grid { display: block; overflow-x: auto; white-space: nowrap; }
table.grid td, table.grid th { white-space: normal; }

ul.cols { columns: 3 15rem; column-gap: var(--s5); list-style: none; padding: 0; }
ul.cols li { margin-bottom: var(--s2); break-inside: avoid; font-family: var(--mono); font-size: .84rem; }

/* ---- cards, notes, flashes ---------------------------------------------- */

.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r); padding: var(--s4) var(--s5); margin-bottom: var(--s3);
}
.card.narrow { max-width: 24rem; }
.card summary { cursor: pointer; padding: var(--s1) 0; }
.card summary:hover { color: var(--accent); }
.card summary strong { margin-right: var(--s2); font-family: var(--mono); font-weight: 600; }
.card summary a.edit { float: right; font-size: .78rem; }

.flash, .note {
  padding: var(--s3) var(--s4); border-radius: var(--r);
  border: 1px solid var(--line); border-left-width: 3px;
  background: var(--panel); margin-bottom: var(--s4);
}
.flash.good { border-left-color: var(--accent); background: var(--accent-dim); }
.flash.bad  { border-left-color: var(--hot); background: var(--hot-dim); color: var(--hot-ink); }
.note { color: var(--dim); border-left-color: var(--faint); font-size: .9rem; }

.pill {
  display: inline-block; padding: .1em .5em; margin-left: var(--s2);
  border: 1px solid var(--accent); border-radius: 2px; color: var(--accent);
  font-family: var(--mono); font-size: .68rem;
  text-transform: uppercase; letter-spacing: .06em;
}
.pill.dimpill { border-color: var(--line); color: var(--dim); }
.pill.hot { border-color: var(--hot); color: var(--hot); }

/* ---- forms -------------------------------------------------------------- */

label { display: block; margin: var(--s3) 0 var(--s1); font-size: .82rem; color: var(--dim); }
.fields label .dim { font-weight: 400; text-transform: none; letter-spacing: 0; }

input[type=text], input[type=password], textarea, select {
  background: var(--well); color: var(--ink);
  border: 1px solid var(--line); border-radius: 3px;
  padding: var(--s2) var(--s3); font: inherit; min-width: 12rem;
}
input[type=text], input[type=password], textarea { font-family: var(--mono); font-size: .86rem; }
textarea { width: 100%; min-height: 24rem; line-height: 1.5; }

input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
/* Keyboard users get the same ring on anything focusable, not just fields. */
a:focus-visible, button:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px;
}

form.inline { display: flex; gap: var(--s2); align-items: center; flex-wrap: wrap; margin: 0 0 var(--s2); }
form.inline label { min-width: 9rem; margin: 0; font-size: .8rem; }

.fieldrow { margin: var(--s1) 0; }
.fields { display: grid; gap: var(--s2); margin-top: var(--s3); }

button, a.btnlink {
  display: inline-block;
  background: var(--accent); color: var(--on-accent); border: 1px solid var(--accent);
  border-radius: 3px; padding: var(--s2) var(--s4);
  font: inherit; font-size: .78rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .07em;
  cursor: pointer; text-decoration: none;
}
button:hover, a.btnlink:hover { filter: brightness(1.12); }
button:active { transform: translateY(1px); }

/* Destructive actions are outlined, not filled: the eye should have to choose
   them deliberately, and a page of solid red buttons reads as an error page. */
button.hot {
  background: transparent; color: var(--hot); border-color: var(--hot);
}
button.hot:hover { background: var(--hot); color: var(--on-accent); filter: none; }

.actions { display: flex; gap: var(--s4); align-items: center; margin-top: var(--s4); flex-wrap: wrap; }
.confirm { display: block; margin-top: var(--s3); color: var(--hot); font-size: .88rem; }
form.danger { margin-top: var(--s7); padding-top: var(--s4); border-top: 1px solid var(--line); }

/* ---- template editor ---------------------------------------------------- */

fieldset.line {
  border: 1px solid var(--line); border-radius: var(--r); background: var(--panel);
  padding: var(--s3) var(--s4) var(--s4); margin-bottom: var(--s4);
}
fieldset.line legend {
  color: var(--accent); font-size: .74rem; font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase; padding: 0 var(--s2);
}
fieldset.line legend .key { color: var(--faint); font-family: var(--mono); text-transform: none; }

.fieldbox {
  display: flex; gap: var(--s2); align-items: flex-start; flex-wrap: wrap;
  padding: var(--s3) 0; border-top: 1px solid var(--line-dim);
}
.fieldbox .pill { margin-left: 0; align-self: center; }
.fieldbox input[type=text] { flex: 1 1 10rem; min-width: 7rem; }
.fieldbox textarea { flex: 2 1 18rem; min-height: 3.2rem; }

#addline { margin-bottom: var(--s4); }

/* ---- the gate: login, "not configured", "not on the list", errors -------- */
/* These pages have no navigation to offer, so they are centred and narrow -
   a door, not a dashboard with the furniture missing. */

/* The gate is a door, not a dashboard: no bar, no panel, one card at 40% of
   the width, centred, over whatever picture the unit uploaded. */
.p-gate .bar { display: none; }
.p-gate .shell { display: block; }
.p-gate main { width: 40%; min-width: 20rem; margin: 0 auto; padding: 0; }
.p-gate h1 { display: none; }        /* the card says the unit's name instead */
.p-gate footer { text-align: center; max-width: none; border: 0; }

body.p-gate {
  min-height: 100vh;
  display: flex; flex-direction: column; justify-content: center;
  padding: var(--s6) 0;
}

/* THE PICTURE GOES ON THE BODY, not behind it. A pseudo-element at a negative
   z-index paints behind its parent's own background, so the earlier version
   was always hidden under the opaque --ground colour. */
body.hasbg {
  background-position: center; background-repeat: no-repeat;
  background-attachment: fixed;
}
body.hasbg::before {
  content: ""; position: fixed; inset: 0; background: #000; opacity: .55; z-index: 0;
}
body.hasbg > * { position: relative; z-index: 1; }

/* With no picture uploaded the gate is still not a flat slab. */
body.p-gate:not(.hasbg) {
  background-image:
    radial-gradient(1200px 600px at 50% -10%, var(--accent-dim), transparent 70%),
    linear-gradient(180deg, var(--raise), var(--ground) 60%);
  background-attachment: fixed;
}

.gate {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r);
  padding: var(--s6); text-align: center;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .45);
}
.gatemark { margin-bottom: var(--s5); }
/* Centred on its own line, so scaling it up cannot pull it off-centre. */
.gatelogo {
  display: block; margin: 0 auto var(--s3);
  height: var(--logo-login); width: auto;
  max-width: 100%; object-fit: contain;
}
.gatename {
  color: var(--ink); font-size: 1.1rem; letter-spacing: .12em;
  text-transform: uppercase; margin: 0 0 var(--s1);
}
.gatetag { color: var(--dim); font-size: .84rem; margin: 0; max-width: none; }
.gatehelp { color: var(--faint); font-size: .78rem; margin: var(--s3) 0 0; max-width: none; }
.gate .flash { text-align: left; }
.gate .steam { width: 100%; }

/* The admin way in is present but quiet - it is the exception, not the offer. */
.gateadmin { margin-top: var(--s5); padding-top: var(--s4); border-top: 1px solid var(--line-dim); }
.linkish {
  background: none; border: 0; padding: 0; color: var(--faint);
  font: inherit; font-size: .74rem; text-transform: uppercase; letter-spacing: .1em;
  cursor: pointer;
}
.linkish:hover { color: var(--accent); }
.adminform { margin-top: var(--s4); text-align: left; }
.adminform label { text-align: left; }
.adminform input { width: 100%; }
.adminform button { width: 100%; margin-top: var(--s3); padding: var(--s3); }

@media (max-width: 60rem) { .p-gate main { width: 92%; } }

/* Sign in through Steam. Steam's own blue rather than the site accent - a
   federated button is recognised by its colour before anyone reads it. */
.steam {
  display: block; text-align: center;
  margin-top: var(--s3); padding: var(--s3) var(--s4);
  background: #1b2838; border: 1px solid var(--steam); border-radius: 3px;
  color: #c7d5e0; text-decoration: none; font-weight: 600;
  text-transform: uppercase; font-size: .78rem; letter-spacing: .07em;
}
.steam:hover { background: #2a475e; color: #fff; }

footer {
  padding: var(--s5); margin-top: var(--s7);
  border-top: 1px solid var(--line-dim);
  color: var(--faint); font-size: .78rem; max-width: 68ch;
}

@media (max-width: 40rem) {
  main { padding: var(--s4); }
  .bar { padding: var(--s3) var(--s4); gap: var(--s3); }
  .bar nav { gap: var(--s4); }
  table.kv th { width: auto; }
  form.inline label { min-width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ==========================================================================
   COLOUR SCHEMES
   Only the tokens change. Every rule above is written against them, so a
   scheme is a palette and nothing else - no per-theme component overrides.
   ========================================================================== */

/* Ghost: taken from ghostsofbattle.com - the rust red #cc4331 the site leans
   on, its off-white #f9f9f9, and its #1c1c1c panels.

   THE ACCENT IS LIFTED A SHADE. #cc4331 exactly gives 3.9:1 against this
   ground - fine for a button with white on it, under the 4.5:1 that link-sized
   text needs. #e05a45 is the same red with the brightness to be read, and
   still reads as theirs. Swap it back if brand fidelity matters more.
   
   WARNINGS GO AMBER, not red: with a red accent, a red warning is just the
   site's own colour and stops meaning "careful". */
[data-theme="ghost"] {
  --ground: #121212; --well: #0a0a0a; --panel: #1c1c1c; --raise: #262626;
  --line: #333333; --line-dim: rgba(249, 249, 249, .07);
  --ink: #f9f9f9; --dim: #a8a8a8; --faint: #6f6f6f;
  --accent: #e05a45; --accent-dim: rgba(204, 67, 49, .18); --on-accent: #f9f9f9;
  --hot: #e8a33d; --hot-dim: rgba(232, 163, 61, .13); --hot-ink: #f4dcb4;
  --warn: #e8a33d;
}

/* Amber: the other phosphor. Same console, different tube. */
[data-theme="amber"] {
  --ground: #100c07; --well: #0a0704; --panel: #1a140d; --raise: #201910;
  --line: #33281a; --line-dim: rgba(255, 200, 120, .09);
  --ink: #f0e2cb; --dim: #a4917a; --faint: #6f6252;
  --accent: #f0a835; --accent-dim: rgba(240, 168, 53, .14); --on-accent: #100c07;
  --hot: #e4574a; --hot-dim: rgba(228, 87, 74, .13); --warn: #f0a835; --hot-ink: #f4c4bf;
}

/* Slate: cool and quiet, for people who find green tiring. */
[data-theme="slate"] {
  --ground: #0d1117; --well: #090d12; --panel: #141a22; --raise: #1a222c;
  --line: #26303c; --line-dim: rgba(180, 200, 230, .08);
  --ink: #dde5ef; --dim: #8b9bb0; --faint: #5f6d80;
  --accent: #7aa2f7; --accent-dim: rgba(122, 162, 247, .15); --on-accent: #0d1117;
  --hot: #f07171; --hot-dim: rgba(240, 113, 113, .13); --warn: #e0af68; --hot-ink: #f6c9c9;
}

/* Daylight: for a bright room or a projector. The accent darkens, because a
   pale green on white is unreadable and fails contrast outright. */
[data-theme="daylight"] {
  --ground: #f4f6f8; --well: #ffffff; --panel: #ffffff; --raise: #eef1f5;
  --line: #d6dce4; --line-dim: rgba(20, 30, 45, .09);
  --ink: #17202b; --dim: #55636f; --faint: #7d8894;
  --accent: #2f7d32; --accent-dim: rgba(47, 125, 50, .12); --on-accent: #ffffff;
  --hot: #b3261e; --hot-dim: rgba(179, 38, 30, .09); --warn: #8a6100; --hot-ink: #7d1d17;
}
[data-theme="daylight"] .bar { background: linear-gradient(#ffffff, #f4f6f8); }
[data-theme="daylight"] .steam { background: #1b2838; color: #e8eef4; }

.themepick { margin-left: auto; display: flex; align-items: center; }
.themepick select {
  min-width: 0; padding: var(--s1) var(--s2); font-size: .76rem;
  background: var(--panel); color: var(--dim); border-color: var(--line);
}
.themepick select:hover { color: var(--ink); }
/* With a nav present the nav's own auto-margin already pushed things right. */
.bar nav + .themepick { margin-left: var(--s4); }

.vh {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

/* ==========================================================================
   THE WIKI PANEL
   ========================================================================== */

/* The measured layout, across the full width:
     2% edge | 50% the work | 3% gutter | 44% the wiki | 1% edge
   Grid rather than flex with gaps, because grid track percentages are of the
   whole width - so each share is the share it says it is, instead of a
   percentage of whatever is left after padding. Columns 1, 3 and 5 are empty
   spacers; the two children are placed by hand so nothing auto-flows into them. */
.shell {
  display: grid;
  grid-template-columns: 2% 50% 3% 44% 1%;
  align-items: start;
}
.shell > main { grid-column: 2; min-width: 0; max-width: none; padding: var(--s5) 0; }
.shell > .wiki { grid-column: 4; }

/* With the panel hidden the work takes the room back rather than sitting in a
   half-width column beside nothing. */
html.nowiki .shell { grid-template-columns: 2% 1fr 1%; }
html.nowiki .shell > main { grid-column: 2; }

.wiki {
  position: sticky; top: 4.2rem;
  max-height: calc(100vh - 5.5rem);
  display: flex; flex-direction: column;
  margin: var(--s5) 0;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r);
  overflow: hidden;
}
.wikihead {
  display: flex; align-items: center; gap: var(--s2);
  padding: var(--s3) var(--s4);
  border-bottom: 1px solid var(--line); background: var(--raise);
}
.wikihead strong { font-size: .82rem; flex: 1; min-width: 0;
                   overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wikimark {
  font-family: var(--mono); font-size: .6rem; letter-spacing: .14em;
  color: var(--accent); border: 1px solid var(--accent-dim);
  padding: .1em .4em; border-radius: 2px;
}
.wikiout, .wikitoggle {
  background: none; border: 0; padding: 0; margin: 0;
  color: var(--faint); font: inherit; font-size: .72rem;
  text-transform: uppercase; letter-spacing: .08em; cursor: pointer;
  text-decoration: none;
}
.wikiout:hover, .wikitoggle:hover { color: var(--accent); }

/* Its own type scale: this is reference text beside the work, not the work. */
.wikibody { overflow-y: auto; padding: var(--s5); font-size: .88rem; line-height: 1.6; }
.wikibody h2 { font-size: .72rem; margin: var(--s4) 0 var(--s2); }
.wikibody h3, .wikibody h4, .wikibody h5, .wikibody h6 {
  font-size: .74rem; color: var(--ink); margin: var(--s4) 0 var(--s1);
  text-transform: none; letter-spacing: 0; font-weight: 600;
}
.wikibody p { margin: 0 0 var(--s3); max-width: none; }
.wikibody ul, .wikibody ol { margin: 0 0 var(--s3); padding-left: var(--s4); }
.wikibody li { margin-bottom: var(--s1); }
.wikibody pre { font-size: .74rem; padding: var(--s3); margin: 0 0 var(--s3); }
.wikibody code { font-size: .8em; }
.wikibody blockquote {
  margin: 0 0 var(--s3); padding-left: var(--s3);
  border-left: 2px solid var(--line); color: var(--dim);
}
.wikibody hr { border: 0; border-top: 1px solid var(--line-dim); margin: var(--s4) 0; }
.wikibody table.wikitable { font-size: .82rem; margin-bottom: var(--s3); }
.wikibody table.wikitable th, .wikibody table.wikitable td { padding: var(--s1) var(--s2); }
.wikistale { font-size: .74rem; font-style: italic; }

/* Hidden by preference, with a way back in the bar. */
html.nowiki .wiki { display: none; }
.wikishow { display: none; }
html.nowiki .wikishow {
  display: inline-block; background: none; border: 1px solid var(--line);
  color: var(--faint); padding: var(--s1) var(--s2); font-size: .72rem;
  text-transform: uppercase; letter-spacing: .08em; cursor: pointer; border-radius: 2px;
}
html.nowiki .wikishow:hover { color: var(--accent); border-color: var(--accent); }

/* The gate pages have no panel, so the shell must not reserve room for one. */
.p-gate .shell { display: block; }

@media (max-width: 68rem) {
  /* Too narrow for two columns: one column, panel underneath. */
  .shell, html.nowiki .shell { grid-template-columns: 2% 1fr 2%; }
  .shell > main, .shell > .wiki { grid-column: 2; }
  .wiki { position: static; margin: 0 0 var(--s5); max-height: 26rem; }
}

/* Read-only: a password session can look, but not change. */
.note.readonly { border-left-color: var(--warn); }
.note.readonly strong { color: var(--warn); }

/* The Steam button carries its mark: a federated button is recognised by its
   logo before its words are read. Inline SVG, so it cannot fail to load. */
.steam { display: flex; align-items: center; justify-content: center; gap: var(--s2); }
.steammark { flex: 0 0 auto; }

.gatewhy {
  margin: var(--s4) 0 0; padding: var(--s3) var(--s4);
  background: var(--well); border: 1px solid var(--line-dim); border-radius: var(--r);
  color: var(--dim); font-size: .76rem; line-height: 1.55; text-align: left; max-width: none;
}
.gatewhy strong { color: var(--ink); }

/* Branding page bits. */
.colourrow { display: flex; align-items: center; gap: var(--s3); }
.colourrow input[type=color] { width: 3.5rem; height: 2rem; min-width: 0; padding: 2px; }
.inlinelabel { display: flex; align-items: center; gap: var(--s2); margin: var(--s2) 0; }
.inlinelabel input[type=checkbox] { width: auto; min-width: 0; }
.brandprev { max-width: 100%; max-height: 8rem; background: var(--well); border: 1px solid var(--line); }
input[type=file] { font-size: .8rem; color: var(--dim); }
input[type=range] { width: 100%; min-width: 0; }

.scalerow { display: flex; align-items: center; gap: var(--s3); }
.scalerow input[type=range] { flex: 1; }
.scalerow output {
  font-family: var(--mono); font-size: .78rem; color: var(--dim);
  min-width: 3.5rem; text-align: right;
}

/* Applying is a real offer on the login page, but not the main one: outlined
   where the Steam button is filled. */
.applybtn {
  display: block; margin-top: var(--s3); padding: var(--s3) var(--s4);
  border: 1px solid var(--line); border-radius: 3px;
  color: var(--ink); text-decoration: none; text-align: center;
  text-transform: uppercase; font-size: .78rem; letter-spacing: .07em; font-weight: 600;
}
.applybtn:hover { border-color: var(--accent); color: var(--accent); }

.qhelp { margin: 0 0 var(--s1); font-size: .8rem; }
textarea.short { min-height: 5rem; }

/* ---- the JSON editor (public/editor.js) ---------------------------------
   The highlighted <pre> and the real <textarea> are stacked. EVERY metric
   that decides where a glyph lands must be identical in both, or the colours
   drift away from the characters as you type. */

.editor { position: relative; margin-bottom: var(--s2); }

.editor > .editor-hl,
.editor > textarea {
  margin: 0;
  padding: var(--s3);
  border: 1px solid var(--line);
  border-radius: var(--r);
  font-family: var(--mono);
  font-size: .82rem;
  line-height: 1.5;
  tab-size: 2;
  white-space: pre;
  overflow: auto;
  word-wrap: normal;
}

.editor > .editor-hl {
  position: absolute; inset: 0;
  background: var(--well);
  color: var(--ink);
  pointer-events: none;
  z-index: 0;
}
.editor > .editor-hl code { font: inherit; background: none; padding: 0; }

.editor > textarea {
  position: relative; z-index: 1;
  display: block; width: 100%; min-height: 28rem;
  background: transparent;
  color: transparent;              /* the <pre> underneath supplies the colour */
  caret-color: var(--accent);
  resize: vertical;
}
.editor > textarea::selection { background: rgba(127, 176, 105, .35); color: transparent; }
.editor > textarea:focus { box-shadow: none; border-color: var(--accent); }

.j-key { color: var(--accent); }
.j-str { color: #d9a441; }
.j-num { color: #7ec9e0; }
.j-lit { color: #c58fd8; font-style: italic; }
.j-pun { color: var(--faint); }

.editor-status {
  margin: 0 0 var(--s4); font-family: var(--mono); font-size: .74rem;
  color: var(--faint); min-height: 1.1em;
}
.editor-status.ok { color: var(--accent); }
.editor-status.bad { color: var(--hot); }

/* A ticket thread: each entry a card, its header quiet so the text leads. */
.reply { padding: var(--s3) var(--s4); }
.reply p { max-width: none; margin: 0; }
.replyhead { font-size: .74rem; margin-bottom: var(--s2) !important; }
.replyhead strong { color: var(--ink); margin-right: var(--s2); }
p.dim a.on { color: var(--accent); }
