/* Operator page styling. Two rules shape everything here:
   - no external requests (the page's CSP is default-src 'none'), so no web
     fonts and no CDN reset;
   - readable in whatever theme the operator's machine is in, hence the
     colour tokens below and the prefers-color-scheme block. */

:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --ink: #16191d;
  --muted: #5d6470;
  --line: #dcdfe5;
  --accent: #1f6feb;
  --ok: #1a7f37;
  --warn: #9a6700;
  --bad: #cf222e;
  --code-bg: #f0f2f5;
  --radius: 8px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --panel: #171a20;
    --ink: #e6e8ec;
    --muted: #9aa2b0;
    --line: #2a2f38;
    --accent: #5b9bff;
    --ok: #3fb950;
    --warn: #d29922;
    --bad: #f85149;
    --code-bg: #11141a;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 0 1.25rem 3rem;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--line);
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.bar-right { display: flex; align-items: center; gap: 0.75rem; }

h1 { font-size: 1.25rem; margin: 0; letter-spacing: -0.01em; }
h2 { font-size: 1rem; margin: 0 0 0.75rem; }
p { margin: 0.25rem 0; }

.muted { color: var(--muted); }
.small { font-size: 0.8125rem; }
.hidden { display: none !important; }

main { display: grid; gap: 1.25rem; max-width: 1200px; margin: 0 auto; }

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

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; }
.stat { display: flex; flex-direction: column; gap: 0.25rem; }
.stat-value { font-size: 1.75rem; font-weight: 600; font-variant-numeric: tabular-nums; }

/* Wide content scrolls inside its own box; the page body never scrolls
   sideways, which is what makes this usable on a laptop screen. */
.table-scroll { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
th, td { text-align: left; padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-weight: 600; color: var(--muted); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; }
tbody tr:last-child td { border-bottom: none; }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover { background: var(--code-bg); }
td.wrap { white-space: normal; word-break: break-all; font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 0.8125rem; }
.actions-col { width: 1%; }

button {
  font: inherit;
  padding: 0.35rem 0.7rem;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
}
button:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
button:disabled { opacity: 0.5; cursor: progress; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.ghost { border-color: transparent; color: var(--muted); }
button.danger:hover { border-color: var(--bad); color: var(--bad); }

.action-group { display: flex; gap: 0.25rem; }
.action-group button { padding: 0.2rem 0.5rem; font-size: 0.8125rem; }

input, select {
  font: inherit;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  color: var(--ink);
  width: 100%;
}

.row { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.row input { width: auto; min-width: 260px; }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0.875rem; align-items: start; }
.grid label { display: grid; gap: 0.25rem; font-size: 0.8125rem; color: var(--muted); }
.grid label input, .grid label select { color: var(--ink); }
.form-actions { display: flex; align-items: end; }
.grid label.checkbox { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; color: var(--ink); font-size: 0.875rem; }
.grid label.checkbox input { width: auto; }
.grid label.checkbox .small { flex-basis: 100%; }

.pill { padding: 0.15rem 0.55rem; border-radius: 999px; font-size: 0.75rem; border: 1px solid var(--line); white-space: nowrap; }
.pill-ok { color: var(--ok); border-color: currentColor; }
.pill-bad { color: var(--bad); border-color: currentColor; }
.pill-warn { color: var(--warn); border-color: currentColor; }
.pill-idle { color: var(--muted); }

code, .output { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; }
.output {
  margin: 1rem 0 0;
  padding: 0.75rem;
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 0.8125rem;
  max-height: 24rem;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

a { color: var(--accent); }

footer { max-width: 1200px; margin: 1.5rem auto 0; }

.toast {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  max-width: min(30rem, calc(100vw - 2.5rem));
  padding: 0.6rem 0.9rem;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 6px 24px rgb(0 0 0 / 0.18);
  font-size: 0.875rem;
  white-space: pre-wrap;
}
.toast.bad { border-color: var(--bad); color: var(--bad); }
.toast.ok { border-color: var(--ok); color: var(--ok); }
