/* One stylesheet, no build step. The console is tables and forms; anything
   that needs a bundler does not belong here. */
:root {
  --fg: #1c1c1c; --muted: #6b6b6b; --bg: #fbfbfa; --panel: #fff;
  --line: #e3e3e0; --accent: #2f5fd0; --bad: #b3261e;
}
@media (prefers-color-scheme: dark) {
  :root {
    --fg: #e8e8e6; --muted: #9a9a95; --bg: #191918; --panel: #212120;
    --line: #34342f; --accent: #7ea2f0; --bad: #f2837b;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font: 15px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}
main { max-width: 68rem; margin: 0 auto; padding: 2rem 1.5rem; }
h1 { font-size: 1.35rem; margin: 0 0 1rem; display: flex; align-items: baseline; gap: 0.75rem; }
h1 .more, h2 .more { font-size: 0.85rem; font-weight: 400; margin-left: auto; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.nav {
  display: flex; align-items: center; gap: 1.25rem;
  padding: 0.75rem 1.5rem; background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.nav .brand { font-weight: 600; color: var(--fg); }
.nav nav { display: flex; gap: 1rem; }
.nav .right { margin-left: auto; display: flex; align-items: center; gap: 0.75rem; }
.nav .who { color: var(--muted); font-size: 0.9rem; }

.centre { display: grid; place-items: center; min-height: 100vh; }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 2rem; width: min(22rem, 90vw); display: grid; gap: 1rem;
}
/* The login card's heading carries no action link and is centred, so it opts
   out of the flex row every other h1 uses. */
.card h1 { margin: 0; display: block; text-align: center; }
label { display: grid; gap: 0.35rem; font-size: 0.9rem; color: var(--muted); }
input {
  font: inherit; padding: 0.5rem 0.6rem; border-radius: 6px;
  border: 1px solid var(--line); background: var(--bg); color: var(--fg);
}
button {
  font: inherit; padding: 0.5rem 0.9rem; border-radius: 6px; cursor: pointer;
  border: 1px solid var(--accent); background: var(--accent); color: #fff;
}
button.link {
  border: none; background: none; color: var(--accent); padding: 0;
}
.error { color: var(--bad); margin: 0; font-size: 0.9rem; }
.empty { color: var(--muted); }

/* --- content --- */
section { margin: 0 0 2.5rem; }

/* The one notice that has to survive not being looked for. Everything else on
   the board is something you came to read; this is something that happened
   while nobody was watching, so it gets a tinted panel and sits above the
   fold rather than in a column somewhere. */
section.alarm {
  background: var(--panel); border: 1px solid #b3261e55;
  border-left: 3px solid var(--bad); border-radius: 6px;
  padding: 1.25rem 1.5rem 0.5rem;
}
section.alarm h1 { color: var(--bad); }

/* The machine list under the form's machine field. Choosing a machine needs
   what the machines page knows — capabilities, how loaded it is — and the
   choice happens here, not there. Sized down so it reads as reference beside
   the field rather than as a second table competing with the form. */
table.machines { margin: 0.5rem 0 0; font-size: 0.85rem; }
table.machines th, table.machines td { padding: 0.3rem 0.6rem 0.3rem 0; }
h2 { font-size: 1.05rem; margin: 0 0 0.75rem; display: flex; align-items: baseline; gap: 0.75rem; }
.lede { color: var(--muted); margin: -0.35rem 0 1rem; font-size: 0.9rem; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.88em; }

table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th { text-align: left; font-weight: 500; color: var(--muted); font-size: 0.82rem; }
th, td { padding: 0.55rem 0.75rem 0.55rem 0; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: none; }

/* facts is a two-column definition list rendered as a table: label left,
   value right, no header row. */
.facts { max-width: 52rem; }
.facts th { width: 9rem; padding-right: 1.25rem; white-space: nowrap; }

.chip {
  display: inline-block; padding: 0.05rem 0.45rem; border-radius: 999px;
  font-size: 0.78rem; border: 1px solid var(--line); color: var(--muted);
  white-space: nowrap;
}
.chip.ok   { color: #1b7f4b; border-color: #1b7f4b55; }
.chip.warn { color: var(--bad); border-color: #b3261e55; }
.chip.muted-chip { opacity: 0.65; }
.s-failed, .s-orphaned, .s-cancelled { color: var(--bad); border-color: #b3261e55; }
.s-running, .s-claimed, .s-queued { color: var(--accent); border-color: #2f5fd055; }
.o-acted { color: #1b7f4b; border-color: #1b7f4b55; }
.o-waiting { color: #9a6b00; border-color: #9a6b0055; }
.v-wake { color: #1b7f4b; border-color: #1b7f4b55; }
.v-self_event, .v-quota_exceeded, .v-project_not_granted, .v-stale_event {
  color: #9a6b00; border-color: #9a6b0055;
}

.filters { display: flex; gap: 0.6rem; margin: 0 0 1rem; }
select {
  font: inherit; padding: 0.35rem 0.5rem; border-radius: 6px;
  border: 1px solid var(--line); background: var(--panel); color: var(--fg);
}

pre {
  margin: 0.35rem 0 0; padding: 0.75rem; border-radius: 8px;
  background: var(--panel); border: 1px solid var(--line);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.82rem; line-height: 1.55;
  white-space: pre-wrap; word-break: break-word; overflow-x: auto;
}
/* The brief is long by nature. It scrolls in its own box rather than pushing
   the transcript off the bottom of the page. */
pre.brief { max-height: 32rem; overflow-y: auto; }
pre.input { opacity: 0.8; }

/* A sortable heading still has to read as a heading, not as a link in a row
   of headings. Only the arrow marks the one in force. */
th .sort { color: inherit; text-decoration: none; white-space: nowrap; }
th .sort:hover { color: var(--accent); text-decoration: none; }

.transcript { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.85rem; }
.transcript .k {
  font-size: 0.78rem; color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  display: flex; align-items: baseline; gap: 0.6rem;
}
/* Pushed to the far edge so the labels stay left-aligned and readable as a
   column, and the times line up as one too. */
.transcript .k .t { margin-left: auto; font-variant-numeric: tabular-nums; }
.transcript .m-tool_use .k { color: var(--accent); }

.card-wide {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 1.25rem 1.5rem; margin-bottom: 1.25rem;
}
.card-wide h2 { margin-bottom: 1rem; }
.nav .here { color: var(--fg); font-weight: 500; }

/* A turn still going. The chip pulses because "is this moving or stuck" is the
   question somebody watching actually has. */
.chip.live { color: var(--accent); border-color: #2f5fd055; }
.chip.live::before {
  content: ""; display: inline-block; width: 0.4rem; height: 0.4rem;
  margin-right: 0.35rem; border-radius: 50%; background: currentColor;
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }
@media (prefers-reduced-motion: reduce) {
  .chip.live::before { animation: none; }
}

/* The end of a watched turn. The page was rendered while it was still running,
   so this line is the only thing that will ever say how it finished. */
.ended {
  margin: 1rem 0 0; padding: 0.6rem 0.9rem; border-radius: 8px;
  background: var(--panel); border: 1px solid var(--line);
  display: flex; align-items: center; gap: 0.5rem; font-size: 0.9rem;
}
.ended a { margin-left: auto; }

/* A link that leaves the console. The marker is what tells a reader the click
   costs them their place, before they make it. */
a.ext::after {
  content: "↗"; font-size: 0.75em; margin-left: 0.15em;
  opacity: 0.5; vertical-align: super;
}
