/* Bob UI: the style of the EVA desktop launcher (Avalonia) carried over
   to the web. Dark theme only, like the launcher. Colours are tokens:
   change them here, never in the rules below. */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("fonts/inter-latin-wght-normal.woff2") format("woff2");
}

:root {
  color-scheme: dark;

  /* Surfaces, from the launcher window. */
  --bg: #0B0D12;           /* window background */
  --surface: #11151D;      /* cards */
  --inset: #0B0E14;        /* inputs, command line, logs */
  --hover: #0F141C;        /* row and group hover */
  --raised: #171C26;       /* button hover */
  --line: #1B2230;         /* card borders */
  --line-strong: #1F2530;  /* input borders, disabled */

  /* Text, from brightest to faintest. */
  --text: #E8ECF4;         /* titles, values */
  --text-2: #C5CCDB;       /* body, parameter names */
  --text-3: #8A95A8;       /* secondary, group headers */
  --muted: #6B7689;        /* labels, subtitles */
  --faint: #56607A;        /* paths, versions, hints */
  --disabled: #3A4254;

  /* Accent: the EVA purple of the launch button. */
  --accent: #5D4CDB;
  --accent-hover: #7567E3;
  --accent-press: #4A3CB0;
  --accent-text: #A99EFF;  /* purple readable on dark, for links */

  /* States. failed is the launcher status red; the others are tuned to
     the same lightness on the dark background. */
  --pending: #E2B866;
  --running: #9D90FF;
  --succeeded: #5ACCA0;
  --warning: #FFA45C;      /* package in QA, something left to do by hand */
  --failed: #FF8C8C;
  --cancelled: #6B7689;

  --mono: Menlo, Consolas, "SFMono-Regular", ui-monospace, monospace;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --radius: 10px;          /* cards */
  --radius-sm: 6px;        /* buttons */
  --radius-xs: 4px;        /* inputs */
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { scrollbar-color: var(--line-strong) var(--bg); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text-2);
  font: 13px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-text); text-decoration: none; }
a:hover { color: var(--text); }
code, pre, .mono { font-family: var(--mono); font-size: 12px; }

/* ----------------------------------------------------------- top bar */

.topbar {
  display: flex;
  align-items: center;
  gap: 36px;
  padding: 0 max(40px, calc((100% - 1200px) / 2));
  height: 64px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 1;
}
.brand { display: flex; align-items: center; gap: 14px; color: var(--accent); }
.brand:hover { color: var(--accent-hover); }
.brand svg { display: block; height: 44px; width: auto; }
.brand .subtitle { margin: 0; }

.nav { display: flex; gap: 28px; align-self: stretch; }
.nav a {
  display: flex;
  align-items: center;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  transition: color .15s, border-color .15s;
}
.nav a:hover { color: var(--text-2); }
.nav a.on { color: var(--text); border-bottom-color: var(--accent); }

/* Connection to the orchestrator. */
.conn {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
}
.conn::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--faint);
}
.conn.live { color: var(--text-3); }
.conn.live::before { background: var(--succeeded); box-shadow: 0 0 0 3px color-mix(in srgb, var(--succeeded) 18%, transparent); }
.conn.down { color: var(--failed); }
.conn.down::before { background: var(--failed); }

/* Counters of the header, before the connection. */
.summary {
  margin-left: auto;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  white-space: nowrap;
}
.summary .n { color: var(--text-2); }
.summary:not([hidden]) + .conn { margin-left: 0; }

/* Logout: after the connection, at the right of the bar. */
.logout { margin: 0 0 0 auto; }
.conn + .logout { margin-left: 0; }

/* ------------------------------------------------------------- login */

.login-page main { max-width: 380px; padding-top: 12vh; }
.login { display: flex; flex-direction: column; gap: 16px; }
.login h1 { margin: 0 0 4px; }
.login label { display: flex; flex-direction: column; gap: 6px; }
.login input {
  padding: 9px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-xs);
  background: var(--inset);
  color: var(--text);
  font: 14px/1.3 var(--sans);
}
.login input:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent); }
.login .btn { justify-content: center; margin-top: 4px; }
.login .alert { margin: 0; }

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

main { padding: 32px 40px 48px; max-width: 1280px; margin: 0 auto; }

/* Small capitals above a value: "DETECTED GAME", "PARAMETERS". */
.label, .subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 1.2px;
  text-transform: uppercase;
}
.subtitle { font-size: 12px; letter-spacing: 1.5px; }

.page-head { display: flex; align-items: flex-end; gap: 24px; flex-wrap: wrap; margin-bottom: 28px; }
.page-head .titles { display: grid; gap: 8px; min-width: 0; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
h1 {
  margin: 0;
  color: var(--text);
  font-size: 22px;
  font-weight: 600;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
h1 code { font-size: 18px; font-weight: 400; color: var(--text); }
.back { color: var(--muted); font-size: 12px; }
.back:hover { color: var(--text-2); }

/* Cards, the launcher's bordered panels. */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 20px;
}
.card > .label:first-child, .card-head { margin-bottom: 14px; }
.card-head { display: flex; align-items: baseline; gap: 12px; }
.card-head .count { color: var(--faint); font-family: var(--mono); font-size: 11px; }
.card-head { align-items: center; }
.card-head .push { margin-left: auto; }
.note { margin: 16px 0 0; font-size: 13px; overflow-wrap: anywhere; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush > .card-head { padding: 20px 24px 0; }

/* Key facts of an object, as label over value. */
.facts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 20px 32px;
  margin: 0;
}
.facts > div { display: grid; gap: 6px; min-width: 0; }
.facts dt { color: var(--muted); font-size: 11px; letter-spacing: 1.2px; text-transform: uppercase; }
.facts dd { margin: 0; color: var(--text); font-size: 15px; font-weight: 500; overflow-wrap: anywhere; }
.facts dd.mono { font-size: 13px; font-weight: 400; color: var(--text-2); }
.facts .wide { grid-column: 1 / -1; }

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

.scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 11px 16px; white-space: nowrap; }
th:first-child, td:first-child { padding-left: 24px; }
th:last-child, td:last-child { padding-right: 24px; }
th {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  border-bottom: 1px solid var(--line);
  padding-top: 14px;
}
td { border-bottom: 1px solid var(--line); color: var(--text-2); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .15s; }
tbody tr:hover { background: var(--hover); }
/* A row that leads to a page: the whole row is clickable (bob.js). */
tr.link { cursor: pointer; }
tr.link a { color: var(--text); font-weight: 500; }
tr.link:hover a { color: var(--accent-text); }
td.wrap { white-space: normal; min-width: 220px; }
td code { color: var(--text-2); }
td a code { color: var(--accent-text); }
td a:hover code { color: var(--text); }
td .sub, .muted { color: var(--faint); }
td .sub { font-family: var(--mono); font-size: 11px; margin-left: 6px; }
td.time { font-family: var(--mono); font-size: 12px; color: var(--text-3); }
td.num { font-family: var(--mono); font-size: 12px; }

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

.state {
  --c: var(--faint);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 3px 10px 3px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--c) 13%, transparent);
  color: var(--c);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  line-height: 1.5;
}
.state::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.state.pending { --c: var(--pending); }
.state.running, .state.building { --c: var(--running); }
.state.running::before, .state.building::before { animation: pulse 1.4s ease-in-out infinite; }
.state.succeeded, .state.ready, .state.online { --c: var(--succeeded); }
.state.warning { --c: var(--warning); }
.state.failed { --c: var(--failed); }
.state.cancelled, .state.offline { --c: var(--cancelled); }
.state.free { --c: var(--faint); }
@keyframes pulse { 50% { opacity: .3; } }
@media (prefers-reduced-motion: reduce) { .state::before { animation: none !important; } }

.error { color: var(--failed); }
.warning { color: var(--warning); }
td.error { font-size: 12px; }

/* Errors and notices in a box. */
.alert {
  border: 1px solid color-mix(in srgb, var(--failed) 35%, var(--line));
  background: color-mix(in srgb, var(--failed) 7%, var(--surface));
  color: var(--failed);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin: 0 0 20px;
  overflow-wrap: anywhere;
}
.alert.warning {
  border-color: color-mix(in srgb, var(--warning) 35%, var(--line));
  background: color-mix(in srgb, var(--warning) 7%, var(--surface));
  color: var(--warning);
}

/* QA directory of a project. */
.notice { color: var(--faint); font-size: 12px; margin: 0 0 10px; }

/* ----------------------------------------------------------- buttons */

/* The launcher's preset buttons: dark, purple border on hover. */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-2);
  font: 600 12px/1.2 var(--sans);
  letter-spacing: .3px;
  transition: background .15s, border-color .15s, color .15s;
}
.btn:hover { background: var(--raised); border-color: var(--accent); color: var(--text); }
.btn:active { background: var(--hover); }
.btn.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.on:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn .n { color: var(--faint); font-family: var(--mono); font-size: 11px; font-weight: 400; }
.btn.on .n { color: rgba(255, 255, 255, .7); }

/* The launch button. */
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  font-size: 11px;
}
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.primary:active { background: var(--accent-press); border-color: var(--accent-press); }

.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }

/* A menu: small-caps label, then a launcher-style box with a chevron. */
.select { display: inline-flex; align-items: center; gap: 12px; position: relative; }
.select select {
  appearance: none;
  min-width: 170px;
  padding: 9px 36px 9px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: 600 12px/1.2 var(--sans);
  letter-spacing: .3px;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.select select:hover { background: var(--raised); border-color: var(--accent); }
.select select:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent); }
.select option { background: var(--surface); color: var(--text-2); }
.select::after {
  content: "";
  position: absolute;
  right: 14px;
  top: 50%;
  width: 6px;
  height: 6px;
  border-right: 1.5px solid var(--text-3);
  border-bottom: 1.5px solid var(--text-3);
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}

/* --------------------------------------------------------------- log */

.log-meta { display: flex; gap: 24px; flex-wrap: wrap; align-items: baseline; margin-bottom: 14px; }
.log-meta .label .v { color: var(--text-3); font-family: var(--mono); font-weight: 400; letter-spacing: 0; text-transform: none; margin-left: 6px; }

/* The launcher's command line box. */
pre {
  margin: 0;
  background: var(--inset);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 16px;
  color: var(--text-2);
  line-height: 1.6;
  overflow: auto;
  max-height: 70vh;
  white-space: pre;
  tab-size: 4;
}
.skip {
  display: block;
  margin: 6px 0;
  padding: 6px 10px;
  border-left: 2px solid var(--pending);
  background: color-mix(in srgb, var(--pending) 8%, transparent);
  color: var(--pending);
  font-family: var(--sans);
  white-space: normal;
}

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

.empty { color: var(--faint); text-align: center; margin: 24px 0; }
.card .empty { margin: 8px 0; }
.project-artifacts td:first-child, .project-aliases td:first-child { color: var(--text); font-weight: 500; }
.label.sub { margin: 20px 24px 8px; }
h1 .alias {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 400;
  color: var(--accent-text);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 2px 10px;
  vertical-align: middle;
}

/* ---------------------------------------------------------- overview */

/* Two columns of the same width: active tasks and requests on the left,
   agents and projects on the right. The page is wider than the others,
   and the bar follows it. */
body[data-live="overview"] main { max-width: 1600px; }
@media (min-width: 721px) {
  body[data-live="overview"] .topbar { padding: 0 max(40px, calc((100% - 1520px) / 2)); }
}
.overview { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.col-head { display: flex; align-items: center; gap: 12px; min-height: 34px; margin-bottom: 12px; }
.col-head h2 { margin: 0; font-size: 15px; font-weight: 600; color: var(--text); }
.col-head .count { color: var(--faint); font-family: var(--mono); font-size: 11px; }
.col-head .filters { margin: 0 0 0 auto; }

table.compact th, table.compact td { padding-left: 8px; padding-right: 8px; }
table.compact th:first-child, table.compact td:first-child { padding-left: 20px; }
table.compact th:last-child, table.compact td:last-child { padding-right: 20px; }

/* What a task makes, and the line under it. */
.target { color: var(--text); font-weight: 500; }
a.target { color: var(--accent-text); }
tr.link a.target { color: var(--text); }
tr.link:hover a.target, a.target:hover { color: var(--accent-text); }
.detail { display: block; margin-top: 2px; font-family: var(--mono); font-size: 11px; color: var(--faint); }

/* Small rounded labels: publish, aliases, and the requests of a task. */
.pill, .chip {
  display: inline-block;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent-text);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 1px 8px;
  white-space: nowrap;
}
td .pill { font-size: 10px; padding: 1px 7px; margin-left: 4px; }
td.reqs { white-space: normal; }
.chip { padding: 2px 7px; margin: 2px 0; }
.chip + .chip { margin-left: 4px; }
tr.link .chip { font-weight: 400; color: var(--accent-text); }
.chip:hover, tr.link .chip:hover { color: var(--text); border-color: var(--accent); }
/* A task shared by several requests. */
.chip.shared { border-color: var(--accent-press); background: color-mix(in srgb, var(--accent) 12%, transparent); }

/* Agents and projects as tiles. */
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
.tile {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: grid;
  gap: 12px;
  align-content: start;
  min-width: 0;
}
.tile.busy { border-color: color-mix(in srgb, var(--running) 35%, var(--line)); }
.tile.off { opacity: .6; }
a.tile { color: inherit; transition: border-color .15s; }
a.tile:hover { border-color: var(--line-strong); }
.tile-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tile-name { color: var(--text); font-weight: 600; font-size: 14px; overflow-wrap: anywhere; }
.tile-head .count { color: var(--faint); font-family: var(--mono); font-size: 11px; white-space: nowrap; }
.tile-body { display: grid; gap: 4px; min-width: 0; }
.tile-body .detail { margin-top: 0; }
.tile-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  border-top: 1px solid var(--line);
  padding-top: 10px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--faint);
}
.tile-foot code { font-size: 11px; color: var(--text-3); }
.tile-foot .state { font-size: 9px; }
.tile-foot .label { font-family: var(--sans); }
.tile-foot .pills { display: flex; flex-wrap: wrap; gap: 6px; margin-right: auto; }
.artifacts { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.artifacts li { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; color: var(--text-2); }
.artifacts .detail { margin-top: 0; white-space: nowrap; }

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

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

@media (max-width: 720px) {
  .topbar { padding: 14px 16px 0; gap: 10px 20px; height: auto; flex-wrap: wrap; }
  .nav { order: 3; width: 100%; height: 40px; }
  .brand .subtitle { display: none; }
  .conn { margin-left: 0; }
  .summary { display: none; }
  .tiles { grid-template-columns: minmax(0, 1fr); }
  main { padding: 24px 16px 40px; }
  .card { padding: 16px; }
  th:first-child, td:first-child { padding-left: 16px; }
  th:last-child, td:last-child { padding-right: 16px; }
}
