/*
 * The console.
 *
 * Deliberately one visual world rather than two: this is a terminal-themed tool
 * for a terminal product, and a light variant of it would be a different design
 * wearing the same class names. Every colour is therefore painted explicitly
 * from a token — the page never inherits a ground from the browser, and never
 * renders one theme's text on the other's background.
 */

:root {
  --bg:        #0e0e13;
  --rail:      #15151d;
  --surface:   #17171f;
  --surface-2: #1e1e28;
  --rule:      #2a2a37;
  --rule-soft: #212129;

  --ink:       #dcdce6;
  --ink-2:     #a6a6b8;
  --muted:     #6e6e84;

  --accent:      #e3ab5c;
  --accent-ink:  #1a1408;
  --accent-soft: #2f2617;

  --go:      #6fbf98;  --go-bg:   #16281f;
  --stop:    #e08a76;  --stop-bg: #2b1a16;
  --wait:    #d5b46a;  --wait-bg: #2a2415;

  --dev: #74b3d8;  --dev-bg: #16232c;
  --adv: #bb92d2;  --adv-bg: #241a2b;
  --ops: #7fc9a3;  --ops-bg: #16281f;

  --f-head: "IBM Plex Sans Condensed", "Helvetica Neue", Arial, sans-serif;
  --f-body: "IBM Plex Serif", Georgia, "Times New Roman", serif;
  --f-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;

  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--f-body);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }

.boot {
  padding: 5rem 1.5rem;
  text-align: center;
  color: var(--muted);
  font-family: var(--f-mono);
  font-size: 13px;
}

/* -- the shell ------------------------------------------------------------ */

.shell { display: grid; grid-template-columns: 234px 1fr; min-height: 100vh; }

.rail {
  background: var(--rail);
  border-right: 1px solid var(--rule);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding: 1.25rem 0 1rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand {
  font-family: var(--f-mono);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .01em;
  padding: 0 1.25rem;
  color: var(--ink);
}
.brand b { color: var(--accent); font-weight: 600; }
.brand span { display: block; color: var(--muted); font-weight: 400; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; margin-top: .2rem; }

.rail nav { display: flex; flex-direction: column; gap: .1rem; }

.nav-group {
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 1rem 1.25rem .35rem;
}

.rail a.item {
  display: flex;
  align-items: baseline;
  gap: .55rem;
  padding: .38rem 1.25rem;
  font-family: var(--f-mono);
  font-size: 13px;
  color: var(--ink-2);
  text-decoration: none;
  border-left: 2px solid transparent;
}
.rail a.item:hover { color: var(--ink); background: var(--surface); }
.rail a.item[aria-current="page"] {
  color: var(--accent);
  border-left-color: var(--accent);
  background: var(--surface);
}
.rail a.item .sigil { color: var(--muted); width: 1ch; }
.rail a.item[aria-current="page"] .sigil { color: var(--accent); }
.rail a.item .tally {
  margin-left: auto;
  font-size: 11px;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 8px;
  padding: 0 .45rem;
}

.rail-foot { margin-top: auto; padding: 1rem 1.25rem 0; border-top: 1px solid var(--rule); }
.whoami { font-family: var(--f-mono); font-size: 12px; color: var(--ink-2); word-break: break-all; }
.whoami .sub { color: var(--muted); font-size: 11px; }

/* -- content -------------------------------------------------------------- */

main { padding: 2.25rem 2.5rem 5rem; max-width: 940px; }

h1 {
  font-family: var(--f-head);
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -.005em;
  margin: 0 0 .3rem;
  text-wrap: balance;
}
h2 {
  font-family: var(--f-head);
  font-size: 1.05rem;
  font-weight: 600;
  margin: 2.25rem 0 .75rem;
  letter-spacing: .01em;
}
.lede { color: var(--ink-2); margin: 0 0 1.75rem; max-width: 62ch; }
p { max-width: 66ch; }

.panel {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 1.25rem 1.35rem;
}
.panel + .panel { margin-top: .75rem; }

.grid { display: grid; gap: .75rem; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.grid.three { grid-template-columns: repeat(auto-fit, minmax(175px, 1fr)); }

.stat .k {
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
}
.stat .v {
  font-family: var(--f-mono);
  font-size: 1.6rem;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  margin-top: .15rem;
}
.stat .v.accent { color: var(--accent); }
.stat .n { color: var(--muted); font-size: 12px; font-family: var(--f-mono); }

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

label { display: block; margin-bottom: .9rem; }
label .t {
  display: block;
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: .3rem;
}
label .hint { display: block; font-size: 12px; color: var(--muted); margin-top: .25rem; }

input[type=text], input[type=email], input[type=password], textarea, select {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 3px;
  color: var(--ink);
  font-family: var(--f-mono);
  font-size: 13px;
  padding: .5rem .6rem;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); outline: none; }

button {
  font-family: var(--f-mono);
  font-size: 13px;
  border-radius: 3px;
  border: 1px solid var(--rule);
  background: var(--surface-2);
  color: var(--ink);
  padding: .45rem .9rem;
  cursor: pointer;
}
button:hover { border-color: var(--muted); }
button[disabled] { opacity: .5; cursor: default; }
button.go { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 500; }
button.go:hover { filter: brightness(1.08); }
button.quiet { background: transparent; color: var(--ink-2); }
button.danger { background: transparent; border-color: var(--stop); color: var(--stop); }
button.danger:hover { background: var(--stop-bg); }
button.link { background: none; border: none; color: var(--accent); padding: 0; text-decoration: underline; }

.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }

/* -- notices -------------------------------------------------------------- */

.note {
  font-family: var(--f-mono);
  font-size: 12.5px;
  border-radius: 3px;
  padding: .6rem .75rem;
  margin-bottom: 1rem;
  border: 1px solid;
}
.note.bad  { color: var(--stop); background: var(--stop-bg); border-color: var(--stop); }
.note.good { color: var(--go);   background: var(--go-bg);   border-color: var(--go); }
.note.warn { color: var(--wait); background: var(--wait-bg); border-color: var(--wait); }

.chip {
  display: inline-block;
  font-family: var(--f-mono);
  font-size: 10.5px;
  letter-spacing: .08em;
  text-transform: uppercase;
  border-radius: 9px;
  padding: .1rem .5rem;
  border: 1px solid;
}
.chip.developer  { color: var(--dev); background: var(--dev-bg); border-color: var(--dev); }
.chip.advertiser { color: var(--adv); background: var(--adv-bg); border-color: var(--adv); }
.chip.operator   { color: var(--ops); background: var(--ops-bg); border-color: var(--ops); }
.chip.on   { color: var(--go);   background: var(--go-bg);   border-color: var(--go); }
.chip.off  { color: var(--muted); background: var(--surface-2); border-color: var(--rule); }
.chip.wait { color: var(--wait); background: var(--wait-bg); border-color: var(--wait); }

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

.table-wrap { overflow-x: auto; border: 1px solid var(--rule); border-radius: 4px; }
table { border-collapse: collapse; width: 100%; font-family: var(--f-mono); font-size: 12.5px; }
th, td { text-align: left; padding: .55rem .75rem; border-bottom: 1px solid var(--rule-soft); white-space: nowrap; }
th {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: .12em;
  text-transform: uppercase;
  font-weight: 500;
  background: var(--surface);
}
tbody tr:last-child td { border-bottom: none; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
.empty { color: var(--muted); font-family: var(--f-mono); font-size: 13px; padding: 1.5rem; text-align: center; }

/* -- the terminal block --------------------------------------------------- */

/*
 * Where a command is shown, it is shown as a terminal shows it. The console is
 * asking someone to paste this into a shell, so making it look like anything
 * else would be a small lie about what they are about to do.
 */
.term {
  background: #08080c;
  border: 1px solid var(--rule);
  border-radius: 4px;
  font-family: var(--f-mono);
  font-size: 12.5px;
  line-height: 1.65;
  padding: .85rem 1rem;
  overflow-x: auto;
  color: var(--ink);
}
.term .c { color: var(--muted); }
.term .p { color: var(--go); }
.term .a { color: var(--accent); }
.term pre { margin: 0; }

.copy-row { display: flex; gap: .5rem; align-items: stretch; }
.copy-row .term { flex: 1; min-width: 0; }

.code {
  font-family: var(--f-mono);
  font-size: 1.5rem;
  letter-spacing: .12em;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px dashed var(--accent);
  border-radius: 4px;
  padding: .6rem 1rem;
  display: inline-block;
}

/* -- steps ---------------------------------------------------------------- */

/*
 * Numbered because the install genuinely is a sequence — step two cannot be
 * done before step one — and not merely to decorate three paragraphs.
 */
ol.steps { list-style: none; counter-reset: step; margin: 0; padding: 0; }
ol.steps > li {
  counter-increment: step;
  position: relative;
  padding: 0 0 1.75rem 2.5rem;
  border-left: 1px solid var(--rule);
  margin-left: .8rem;
}
ol.steps > li:last-child { border-left-color: transparent; padding-bottom: 0; }
ol.steps > li::before {
  content: counter(step);
  position: absolute;
  left: -.8rem;
  top: 0;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--rule);
  color: var(--accent);
  font-family: var(--f-mono);
  font-size: 11px;
  display: grid;
  place-items: center;
}
ol.steps h3 {
  font-family: var(--f-head);
  font-size: .98rem;
  font-weight: 600;
  margin: .1rem 0 .5rem;
}

/* -- the auth screens ----------------------------------------------------- */

.gate { min-height: 100vh; display: grid; place-items: center; padding: 2rem 1.25rem; }
.gate-in { width: 100%; max-width: 380px; }
.gate-brand {
  font-family: var(--f-mono);
  font-size: 14px;
  font-weight: 600;
  margin-bottom: .25rem;
}
.gate-brand b { color: var(--accent); }
.gate-tag { color: var(--muted); font-size: 13px; margin: 0 0 1.75rem; font-family: var(--f-mono); }
.gate .panel { padding: 1.5rem; }
.gate h1 { font-size: 1.2rem; margin-bottom: 1.1rem; }
.gate-alt { margin-top: 1.1rem; font-size: 13px; color: var(--muted); font-family: var(--f-mono); text-align: center; }

.picker { display: grid; gap: .5rem; grid-template-columns: 1fr 1fr; margin-bottom: 1rem; }
.picker button {
  text-align: left;
  padding: .7rem .8rem;
  line-height: 1.35;
  background: var(--bg);
}
.picker button .n { display: block; color: var(--ink); font-weight: 500; }
.picker button .d { display: block; color: var(--muted); font-size: 11px; margin-top: .2rem; white-space: normal; }
.picker button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.picker button[aria-pressed="true"] .n { color: var(--accent); }

/* -- misc ----------------------------------------------------------------- */

.dl { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1.25rem; font-family: var(--f-mono); font-size: 13px; }
.dl dt { color: var(--muted); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; align-self: center; }
.dl dd { margin: 0; color: var(--ink); word-break: break-all; }

hr { border: none; border-top: 1px solid var(--rule); margin: 2rem 0; }
.muted { color: var(--muted); }
.mono { font-family: var(--f-mono); font-size: 13px; }
.tight { margin-top: 0; }

@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .rail { position: static; height: auto; }
  main { padding: 1.5rem 1.25rem 4rem; }
  .picker { grid-template-columns: 1fr; }
}

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