/* Salvara console.
 *
 * Served from the binary, like everything else. No script, no font and no
 * stylesheet is fetched from anywhere: the content security policy forbids it,
 * and a console that reaches out to a third party on every page is a console
 * that tells that third party which customers exist.
 *
 * The layout is a fixed sidebar beside a scrolling column of content. This is a
 * tool somebody keeps open all day next to other windows, so the navigation
 * stays where it was and the eye only has to track one thing.
 */

:root {
  --bg: #0b0f14;
  --surface: #131a22;
  --surface-2: #19222c;
  --line: #243040;
  --line-soft: #1b2430;

  --text: #e4ebf3;
  --text-dim: #8fa0b4;
  --text-faint: #64748b;

  --accent: #4da3ff;
  --accent-ink: #04121f;
  --ok: #3fc07d;
  --warn: #e9b949;
  --bad: #ef5f52;

  --radius: 8px;
  --radius-sm: 5px;
  --sidebar: 232px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 16px rgba(0, 0, 0, .25);
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, sans-serif;
  letter-spacing: .1px;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

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

.bar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar);
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 20px 14px;
  background: var(--surface);
  border-right: 1px solid var(--line);
  overflow-y: auto;
}

.brand {
  display: block;
  color: var(--text);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: 1.4px;
  padding: 2px 10px 20px;
}
.brand:hover { text-decoration: none; }

.bar nav { display: flex; flex-direction: column; gap: 2px; }

.bar nav a {
  display: block;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-size: 14px;
}
.bar nav a:hover {
  background: var(--surface-2);
  color: var(--text);
  text-decoration: none;
}

/* The signed-in account sits at the bottom, out of the navigation's way but
 * always visible: on a console that shows every customer, knowing which account
 * you are using is not a detail. */
.out {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--line-soft);
}
.who { display: block; padding: 0 10px 10px; font-size: 13px; }
.who em { display: block; color: var(--text-faint); font-style: normal; font-size: 12px; }

main {
  margin-left: var(--sidebar);
  padding: 32px 36px 96px;
  max-width: 1460px;
}

h1 {
  font-size: 23px;
  font-weight: 600;
  margin: 0 0 24px;
  letter-spacing: -.2px;
}
h2 {
  font-size: 12px;
  font-weight: 700;
  margin: 36px 0 12px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 1px;
}
h3 { font-size: 15px; font-weight: 600; margin: 0 0 10px; }

/* --- messages ------------------------------------------------------------- */

.problem, .notice {
  padding: 12px 16px;
  margin: 0 0 20px;
  border-radius: var(--radius-sm);
  border-left: 3px solid;
  max-width: 820px;
  font-size: 14px;
}
.problem { background: #2a1714; border-color: var(--bad); }
.notice  { background: #11241c; border-color: var(--ok); }

.hint {
  color: var(--text-dim);
  font-size: 13px;
  max-width: 820px;
  line-height: 1.6;
}
.ok-text { color: var(--ok); }
.warn-text { color: var(--warn); }
.bad-text { color: var(--bad); }

/* --- key figures ---------------------------------------------------------- */

.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 8px;
}
.kpi {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.kpi b {
  display: block;
  font-size: 26px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -.5px;
  font-variant-numeric: tabular-nums;
}
.kpi span {
  display: block;
  margin-top: 4px;
  color: var(--text-faint);
  font-size: 12px;
}
.kpi.warn { border-color: #4a3a12; }
.kpi.warn b { color: var(--warn); }
.kpi.bad { border-color: #4a211c; }
.kpi.bad b { color: var(--bad); }

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

.table-wrap {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
th {
  text-align: left;
  padding: 11px 16px;
  color: var(--text-faint);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .8px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-2); }
td small { display: block; color: var(--text-faint); font-size: 12px; margin-top: 2px; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }

/* --- the 28-day strip ----------------------------------------------------- */

.strip { display: inline-flex; gap: 2px; }
.strip i {
  width: 6px;
  height: 20px;
  border-radius: 2px;
  background: #212b36;
}
.strip i.d-ok { background: var(--ok); }
.strip i.d-errors { background: var(--warn); }
.strip i.d-failed { background: var(--bad); }

/* --- state pills ---------------------------------------------------------- */

.pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  border: 1px solid transparent;
}
.p-approved { background: #11291e; color: var(--ok); border-color: #1d4532; }
.p-pending  { background: #2c2510; color: var(--warn); border-color: #4a3f1b; }
.p-blocked  { background: #2b1714; color: var(--bad); border-color: #4a2621; }
.p-retired  { background: #1b222c; color: var(--text-faint); border-color: var(--line); }

/* --- cards and forms ------------------------------------------------------ */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 24px;
  margin-bottom: 16px;
}
.card.narrow { max-width: 520px; }
.card p { margin-top: 0; }
.card p:last-child { margin-bottom: 0; }

label {
  display: block;
  margin: 16px 0 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-dim);
}

input[type=text], input[type=password], input[type=number], select, textarea {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text);
  font: inherit;
}
input::placeholder { color: var(--text-faint); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(77, 163, 255, .18);
}

button, .button {
  display: inline-block;
  margin-top: 18px;
  padding: 10px 20px;
  background: var(--accent);
  color: var(--accent-ink);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
button:hover, .button:hover { filter: brightness(1.08); text-decoration: none; }
button:active { filter: brightness(.95); }

/* Row actions are small, quiet and sized to their text, so a table full of them
 * does not look like a wall of buttons. */
.actions { display: flex; gap: 8px; align-items: center; justify-content: flex-end; }
.actions form { display: flex; gap: 6px; align-items: center; margin: 0; }
.actions button, .out button {
  margin: 0;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 500;
  background: var(--surface-2);
  color: var(--text-dim);
  border-color: var(--line);
}
.actions button:hover { background: #22303e; color: var(--text); filter: none; }
.actions button.go:hover { background: #163528; color: var(--ok); border-color: #1d4532; }
.actions button.stop:hover { background: #321915; color: var(--bad); border-color: #4a2621; }
.out button { width: 100%; }
button.plain { background: var(--surface-2); color: var(--text); border-color: var(--line); }

input.inline {
  width: 6.5em;
  padding: 6px 10px;
  font-size: 13px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* --- login and setup ------------------------------------------------------ */

/* Without a sidebar the content would sit against the left edge of a wide
 * screen, which makes a login page look like a fragment of something else. */
body.plain main {
  margin: 0 auto;
  padding: 72px 24px;
  max-width: 560px;
}
body.plain h1 { text-align: center; margin-bottom: 28px; }
body.plain .card { box-shadow: var(--shadow); }

/* --- secrets and code ----------------------------------------------------- */

code, textarea.uri, .secret {
  font-family: "Cascadia Mono", Consolas, ui-monospace, monospace;
}
code { font-size: 13px; }
code.small { font-size: 12px; color: var(--text-faint); word-break: break-all; }

.secret {
  display: block;
  margin: 8px 0;
  padding: 16px 18px;
  background: var(--bg);
  border: 1px dashed var(--accent);
  border-radius: var(--radius-sm);
  font-size: 17px;
  letter-spacing: 1.5px;
  line-height: 1.7;
  word-break: break-all;
  user-select: all;
}

textarea.uri {
  resize: vertical;
  font-size: 12.5px;
  line-height: 1.5;
  word-break: break-all;
}

.steps { max-width: 880px; padding-left: 22px; }
.steps li { margin-bottom: 16px; }
.steps li::marker { color: var(--text-faint); }

.facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 10px 28px;
  margin: 0;
  font-size: 14px;
}
.facts dt { color: var(--text-faint); font-size: 13px; }
.facts dd { margin: 0; }

.errors { max-width: 1000px; color: var(--warn); font-size: 13px; }
.errors li { margin-bottom: 5px; word-break: break-all; }

/* --- second factor setup -------------------------------------------------- */

.qrrow { display: flex; gap: 36px; align-items: flex-start; flex-wrap: wrap; }
.qrrow form { min-width: 240px; flex: 1; }

/* The code is read by a camera, so it needs a light quiet zone around it
 * whatever the rest of the page does. */
.qr {
  background: #fff;
  padding: 14px;
  border-radius: var(--radius-sm);
  display: block;
}

details.card summary {
  cursor: pointer;
  color: var(--text-dim);
  font-size: 14px;
  list-style: none;
}
details.card summary::before { content: "\25B8  "; color: var(--text-faint); }
details.card[open] summary::before { content: "\25BE  "; }
details.card[open] summary { margin-bottom: 12px; }

/* --- empty states --------------------------------------------------------- */

/* An empty list is a normal state, not a hole in the page. Saying so, and
 * saying what to do next, beats a blank area somebody reads as a fault. */
.empty {
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 36px 24px;
  text-align: center;
  color: var(--text-dim);
}
.empty strong { display: block; color: var(--text); margin-bottom: 6px; font-weight: 600; }
.empty .button { margin-top: 16px; }

/* --- narrow screens ------------------------------------------------------- */

@media (max-width: 860px) {
  .bar {
    position: static;
    width: auto;
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px 16px;
    border-right: none;
    border-bottom: 1px solid var(--line);
  }
  .brand { padding: 0 8px 0 0; }
  .bar nav { flex-direction: row; flex-wrap: wrap; flex: 1; }
  .out { margin: 0; padding: 0; border: none; display: flex; align-items: center; gap: 10px; }
  .who { padding: 0; }
  .out button { width: auto; }
  main { margin-left: 0; padding: 20px 16px 64px; }
}

/* --- side-by-side form fields --------------------------------------------- */

/* Four short fields on one line read as one record; stacked they read as four
 * unrelated questions. */
.row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0 18px;
}
.row label:first-child { margin-top: 0; }

.actions.left { justify-content: flex-start; margin-top: 18px; }

/* A card that belongs to the one above it, carrying its actions. */
.card.sub {
  margin-top: -12px;
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  padding: 14px 24px;
  background: var(--surface-2);
}
.card.sub .actions { margin-top: 0; }

/* --- progress ------------------------------------------------------------- */

/* Named "progress", not "bar": .bar is the navigation sidebar, and giving the
 * progress indicator the same name made the sidebar ten pixels tall with its
 * contents clipped away. The whole menu disappeared, and nothing about the
 * markup suggested why. */
.progress {
  height: 10px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
  margin: 4px 0 10px;
  max-width: 640px;
}
.progress i {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
}

/* Without a reference there is nothing to fill, and an indicator that pretends
 * otherwise is one somebody plans around. This one only says "moving". */
.progress.indeterminate { background: repeating-linear-gradient(
    110deg, var(--surface-2) 0 10px, var(--bg) 10px 20px); }
.progress.indeterminate i { background: none; }

h3 small { color: var(--text-faint); font-weight: 400; font-size: 13px; }

/* --- compact device header ------------------------------------------------ */

/* A tall two-column list of eight facts pushed everything that matters below
 * the fold. The same facts on one wrapping line are read in a glance, and what
 * nobody reads twice a day moved into a fold of its own. */
.card.head { padding: 14px 18px; }

.facts-inline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 22px;
  font-size: 13px;
  color: var(--text);
}
.facts-inline b {
  color: var(--text-faint);
  font-weight: 500;
  margin-right: 5px;
}
.facts-inline .grow { margin-left: auto; }

.card.head .actions { margin-top: 12px; }

.card.quiet {
  padding: 12px 18px;
  background: none;
  border-style: dashed;
}
.card.quiet .facts { margin-top: 10px; font-size: 13px; }

.p-running { background: #10263a; color: var(--accent); border-color: #1d4466; }

/* The source editor is a form, not a report: smaller rows fit more of it on
 * screen at once, which is the whole point of editing it in a table. */
.card td input[type=text], .card td textarea {
  padding: 6px 9px;
  font-size: 13px;
}
.card td { padding: 7px 10px; }
.card th { padding: 8px 10px; }
.card .table-wrap { margin-bottom: 4px; }

/* --- action bars ---------------------------------------------------------- */

/* A single button in a card of its own leaves a wide empty field beside it and
 * pushes everything below further down. A bar puts the button and its one
 * sentence on the same line, where they belong together anyway. */
.toolbar {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.toolbar button { margin-top: 0; }
.toolbar .hint { margin: 0; flex: 1; min-width: 240px; }

.card.toolbar-card { padding: 14px 18px; }

/* Tables of records read better tight: a row is one line, not a paragraph. */
table td { padding: 9px 16px; }
td small { margin-top: 0; }

/* Several bars in one card are separated by a line, not by a gap: they are
 * variations of the same decision, not separate sections. */
.card.toolbar-card .toolbar + .toolbar {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line-soft);
}
.card.toolbar-card .toolbar .inline { flex: 0 0 auto; }

/* Names and identifiers are not prose: breaking "A-SRV01" across two lines
 * makes a list of machines unreadable at exactly the width where it matters. */
td a, .facts-inline, .pill { white-space: nowrap; }
td:first-child { white-space: nowrap; }
