/* One stylesheet, no framework.
 *
 * Dark by default with a light variant driven by the operating system, because
 * this is a tool people leave open beside a terminal. Everything is laid out
 * with flex and grid so there is nothing to recompute on resize.
 */

:root {
  --bg: #0f1115;
  --panel: #171a21;
  --panel-2: #1e222b;
  --line: #2a2f3a;
  --text: #e6e9ef;
  --muted: #949bab;
  --accent: #5b9dff;
  --accent-soft: #1b2a44;
  --ok: #46c08a;
  --warn: #e0b341;
  --bad: #e8615f;
  --radius: 8px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f5f6f8;
    --panel: #ffffff;
    --panel-2: #f0f2f5;
    --line: #dfe3e9;
    --text: #1a1d23;
    --muted: #5f6775;
    --accent: #1f6feb;
    --accent-soft: #e4edfd;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

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

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

.shell { display: flex; min-height: 100vh; }

.side {
  width: 210px;
  flex: none;
  border-right: 1px solid var(--line);
  background: var(--panel);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.brand {
  font-weight: 650;
  font-size: 16px;
  padding: 4px 8px 14px;
  letter-spacing: .2px;
}

.side nav a {
  display: block;
  padding: 7px 10px;
  border-radius: 6px;
  color: var(--text);
}
.side nav a:hover { background: var(--panel-2); text-decoration: none; }
.side nav a.on { background: var(--accent-soft); color: var(--accent); }

/* A rule between groups of navigation links. Border rather than margin so the
   grouping survives the horizontal layout on narrow screens, where the links
   wrap and vertical margins collapse into nothing. */
.side .navgap {
  height: 1px;
  background: var(--line);
  margin: 8px 4px;
}

.side .spacer { flex: 1; }

.main { flex: 1; min-width: 0; padding: 22px 26px 60px; }

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

h1 { font-size: 20px; margin: 0; font-weight: 620; }
h2 { font-size: 15px; margin: 26px 0 10px; font-weight: 600; }
h3 { font-size: 13px; margin: 0 0 6px; font-weight: 600; }

.sub { color: var(--muted); font-size: 13px; margin: 2px 0 0; }

/* ---- controls ------------------------------------------------------- */

button, .btn {
  font: inherit;
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  cursor: pointer;
}
button:hover, .btn:hover { border-color: var(--accent); text-decoration: none; }
button:disabled { opacity: .5; cursor: not-allowed; }

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
button.danger { color: var(--bad); }

input, select, textarea {
  font: inherit;
  width: 100%;
  padding: 7px 10px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
}
textarea { font-family: var(--mono); font-size: 12.5px; min-height: 300px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

label { display: block; margin-bottom: 12px; }
label .lbl { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 4px; }
label .hint { display: block; font-size: 12px; color: var(--muted); margin-top: 4px; }

.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }

/* ---- panels --------------------------------------------------------- */

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}

.cards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }

.applist { display: flex; flex-direction: column; gap: 8px; }

.app {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.app .name { font-weight: 600; }
.app .host { color: var(--muted); font-size: 12.5px; font-family: var(--mono); }

.tile { cursor: pointer; text-align: left; display: flex; flex-direction: column; gap: 6px; }
.tile .desc { color: var(--muted); font-size: 12.5px; flex: 1; }

/* ---- bits ----------------------------------------------------------- */

.pill {
  font-size: 11.5px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  white-space: nowrap;
}
.pill.ok { color: var(--ok); border-color: var(--ok); }
.pill.warn { color: var(--warn); border-color: var(--warn); }
.pill.bad { color: var(--bad); border-color: var(--bad); }
.pill.accent { color: var(--accent); border-color: var(--accent); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 18px 0 16px; }
.tabs button {
  border: 0;
  background: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  padding: 8px 12px;
  color: var(--muted);
}
.tabs button.on { color: var(--text); border-bottom-color: var(--accent); }

pre.logs {
  background: #0a0c10;
  color: #cdd3de;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  font-family: var(--mono);
  font-size: 12.5px;
  max-height: 60vh;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.hidden { display: none; }

/* Wide tables scroll inside their own box rather than pushing the page
   sideways. A release digest and a webhook URL are both long enough to do that
   on a laptop, and a horizontally scrolling page hides the navigation. */
.scroll { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 500; font-size: 12.5px; }
td.mono { font-family: var(--mono); font-size: 12.5px; word-break: break-all; }

.empty { color: var(--muted); padding: 22px; text-align: center; border: 1px dashed var(--line); border-radius: var(--radius); }

.msg { padding: 10px 12px; border-radius: 6px; margin-bottom: 14px; border: 1px solid; }
.msg.err { color: var(--bad); border-color: var(--bad); background: color-mix(in srgb, var(--bad) 8%, transparent); }
.msg.ok { color: var(--ok); border-color: var(--ok); background: color-mix(in srgb, var(--ok) 8%, transparent); }

/* ---- auth ----------------------------------------------------------- */

.auth { max-width: 380px; margin: 12vh auto; }
.auth .card { padding: 22px; }
.auth h1 { margin-bottom: 4px; }

/* ---- modal ---------------------------------------------------------- */

.veil {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .55);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 6vh 16px;
  overflow: auto;
}
.modal { width: 100%; max-width: 560px; }

@media (max-width: 720px) {
  .shell { flex-direction: column; }
  .side { width: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .side nav { display: flex; flex-wrap: wrap; gap: 4px; }
  .main { padding: 16px; }
}

/* The fleet view's headline numbers.
   Large enough to be read from across a room, because the page they are on is
   the one an operator opens when something is wrong and they are standing up. */
.statv {
  font-size: 30px;
  line-height: 1.1;
  margin: 6px 0 0;
  font-variant-numeric: tabular-nums;
}

.statv.warn { color: var(--warn); }
.statv.bad { color: var(--bad); }

/* The policy links, in the sidebar and on the sign-in screen.
   Quiet, because nobody using the platform needs them, and present on every
   page because the one person who does need them arrives without an account. */
.policies { margin-top: 10px; }
.policies a { color: var(--muted); text-decoration: none; }
.policies a:hover { text-decoration: underline; }

/* The policy pages themselves, served from /legal/ as plain documents.
   A measure wide enough to read a paragraph of legal text in and no wider;
   these are the only pages here somebody reads top to bottom. */
body.legal { background: var(--bg); }
body.legal main { max-width: 46rem; margin: 0 auto; padding: 32px 20px 64px; }
body.legal h1 { margin-bottom: 4px; }
body.legal h2 { margin-top: 32px; font-size: 18px; }
body.legal h3 { margin-top: 24px; font-size: 15px; }
body.legal p, body.legal li { line-height: 1.6; }
body.legal li { margin-bottom: 6px; }
body.legal table { width: 100%; margin: 16px 0; }
body.legal td, body.legal th { vertical-align: top; padding: 8px 10px 8px 0; }

.legal-nav { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 28px; }
.legal-nav a { color: var(--muted); text-decoration: none; font-size: 13px; }
.legal-nav a:hover { color: var(--text); text-decoration: underline; }

.legal-index { list-style: none; padding: 0; }
.legal-index li { margin-bottom: 14px; }
.legal-index .sub { display: block; }

.legal-foot {
  margin-top: 48px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  font-size: 13px;
}
