/* =====================================================================
   A.T. Automations - single-theme instrument panel.
   Committed dark palette; every colour is painted explicitly so the page
   holds on any host ground. Status is never carried by colour alone:
   each state ships a glyph and a word as well as a hue.
   ===================================================================== */
:root {
  --ink:        #070B10;
  --panel:      #0E1620;
  --panel-2:    #131E2A;
  --panel-3:    #18242F;
  --line:       #1E2C3B;
  --line-soft:  #172231;

  --text:       #E6EDF5;
  --text-dim:   #93A6BA;
  --text-faint: #64788D;

  --amber:      #E9A63C;   /* warm gold - "a human decides this" */
  --amber-deep: #BC8329;
  --teal:       #3ECBB0;   /* blue-green - "the robot finished it" */
  --teal-deep:  #2FA894;
  --rose:       #E0606A;   /* muted red - "the environment failed" */
  --slate:      #7C8FA5;   /* grey-blue - "waiting in the queue" */

  --radius:     10px;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Archivo", "IBM Plex Sans", system-ui, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Ambient field: a faint instrument glow, not a gradient hero. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(900px 500px at 12% -8%, rgba(233, 166, 60, 0.07), transparent 65%),
    radial-gradient(700px 420px at 92% 4%, rgba(62, 203, 176, 0.05), transparent 62%);
  z-index: 0;
}

.shell { position: relative; z-index: 1; max-width: 1180px; margin: 0 auto; padding-inline: 22px; }

h1, h2, h3 { font-family: var(--display); font-weight: 800; letter-spacing: -0.028em; text-wrap: balance; margin: 0; }
p { margin: 0; }
a { color: var(--amber); text-decoration-color: rgba(233, 166, 60, 0.35); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--amber); }

.eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-faint);
}

/* ---------------------------------------------------------------- nav */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: rgba(7, 11, 16, 0.88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line-soft);
}
.topbar-inner { max-width: 1180px; margin: 0 auto; padding: 10px 22px; display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.wordmark { font-family: var(--display); font-weight: 800; font-size: 15px; letter-spacing: -0.02em; white-space: nowrap; }
.wordmark span { color: var(--amber); }
.navlinks { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
.navlinks a {
  font-size: 12.5px; color: var(--text-dim); text-decoration: none;
  padding: 5px 9px; border-radius: 6px; white-space: nowrap;
}
.navlinks a:hover { color: var(--text); background: var(--panel-2); }

/* ------------------------------------------------------------- header */
.masthead { padding-block: 54px 30px; }
.masthead h1 { font-size: clamp(38px, 6.2vw, 70px); line-height: 0.98; }
.masthead h1 .dim { color: var(--text-faint); }
.thesis { max-width: 62ch; color: var(--text-dim); font-size: 17px; margin-top: 20px; }
.thesis strong { color: var(--text); font-weight: 600; }

.mode-strip {
  margin-top: 26px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  font-family: var(--mono); font-size: 12px;
}
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 11px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--text-dim);
}
.chip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--slate); }
.chip.live { border-color: rgba(62, 203, 176, 0.4); color: var(--teal); }
.chip.live .dot { background: var(--teal); box-shadow: 0 0 0 3px rgba(62, 203, 176, 0.15); }
.chip.snapshot { border-color: rgba(233, 166, 60, 0.4); color: var(--amber); }
.chip.snapshot .dot { background: var(--amber); }

.notice {
  margin-top: 22px; padding: 13px 16px; border-radius: var(--radius);
  border: 1px solid rgba(233, 166, 60, 0.28);
  background: rgba(233, 166, 60, 0.06);
  color: var(--text-dim); font-size: 13.5px;
  display: flex; gap: 11px; align-items: flex-start;
}
.notice b { color: var(--amber); font-weight: 600; }

/* ---------------------------------------------------------------- kpi */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); gap: 1px; background: var(--line-soft); border: 1px solid var(--line-soft); border-radius: var(--radius); overflow: hidden; margin-top: 30px; }
.kpi { background: var(--panel); padding: 16px 18px; }
.kpi .label { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-faint); }
.kpi .value { font-family: var(--display); font-weight: 800; font-size: 27px; letter-spacing: -0.03em; margin-top: 6px; font-variant-numeric: tabular-nums; }
.kpi .sub { font-size: 12px; color: var(--text-faint); margin-top: 2px; }
.kpi.accent .value { color: var(--amber); }
.kpi.good .value { color: var(--teal); }

/* ------------------------------------------------------------ section */
section { padding-block: 52px; border-top: 1px solid var(--line-soft); }
.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 18px; flex-wrap: wrap; margin-bottom: 8px; }
.sec-head h2 { font-size: clamp(23px, 3vw, 31px); }
.sec-lede { color: var(--text-dim); max-width: 68ch; margin-top: 10px; }
.sec-lede + .sec-lede { margin-top: 12px; }

/* ------------------------------------------------------------- panels */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.panel-head { padding: 13px 16px; border-bottom: 1px solid var(--line-soft); display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.panel-head h3 { font-size: 14.5px; font-weight: 600; letter-spacing: -0.01em; }
.panel-body { padding: 16px; }

.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px; }

/* ------------------------------------------------------------ buttons */
button, .btn {
  font-family: var(--sans); font-size: 13px; font-weight: 600;
  border-radius: 7px; border: 1px solid var(--line);
  background: var(--panel-3); color: var(--text);
  padding: 8px 14px; cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, transform 80ms ease;
}
button:hover:not(:disabled) { background: #1F2E3C; border-color: #2A3C4E; }
button:active:not(:disabled) { transform: translateY(1px); }
button:disabled { opacity: 0.45; cursor: not-allowed; }
button:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible {
  outline: 2px solid var(--amber); outline-offset: 2px;
}
button.primary { background: var(--amber); border-color: var(--amber); color: #1A1205; }
button.primary:hover:not(:disabled) { background: #F2B551; border-color: #F2B551; }
button.ghost { background: transparent; }
button.good { border-color: rgba(62, 203, 176, 0.45); color: var(--teal); background: rgba(62, 203, 176, 0.08); }
button.danger { border-color: rgba(224, 96, 106, 0.45); color: var(--rose); background: rgba(224, 96, 106, 0.08); }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

select, textarea, input[type="text"] {
  font-family: var(--mono); font-size: 13px;
  background: var(--ink); color: var(--text);
  border: 1px solid var(--line); border-radius: 7px; padding: 8px 10px;
}
select:disabled { opacity: 0.45; cursor: not-allowed; }
textarea { width: 100%; resize: vertical; line-height: 1.55; }
label.field { display: inline-flex; flex-direction: column; gap: 5px; font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-faint); }

/* -------------------------------------------------------------- pills */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--mono); font-size: 11px; font-weight: 500;
  padding: 3px 9px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--text-dim);
  white-space: nowrap;
}
.pill .glyph { font-weight: 600; }
.pill.ok      { color: var(--teal);  border-color: rgba(62, 203, 176, 0.4);  background: rgba(62, 203, 176, 0.09); }
.pill.human   { color: var(--amber); border-color: rgba(233, 166, 60, 0.4);  background: rgba(233, 166, 60, 0.09); }
.pill.fault   { color: var(--rose);  border-color: rgba(224, 96, 106, 0.42); background: rgba(224, 96, 106, 0.09); }
.pill.queued  { color: var(--slate); border-color: rgba(124, 143, 165, 0.4); background: rgba(124, 143, 165, 0.09); }

/* ------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left; font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--text-faint); font-weight: 500;
  padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
td { padding: 9px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: rgba(255, 255, 255, 0.018); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--mono); }
td.mono, .mono-text { font-family: var(--mono); font-size: 12px; }
.muted { color: var(--text-faint); }
.nowrap { white-space: nowrap; }

/* ------------------------------------------------------------ console */
.proc-card { display: flex; flex-direction: column; gap: 12px; padding: 16px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.proc-card h3 { font-size: 16px; }
.proc-card .desc { font-size: 13px; color: var(--text-dim); flex: 1; }
.proc-meta { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; font-family: var(--mono); font-size: 11.5px; color: var(--text-faint); }
.proc-meta dt { color: var(--text-faint); }
.proc-meta dd { margin: 0; color: var(--text-dim); }

.run-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 1px; background: var(--line-soft); border: 1px solid var(--line-soft); border-radius: 8px; overflow: hidden; }
.run-summary div { background: var(--panel-2); padding: 10px 12px; }
.run-summary .n { font-family: var(--display); font-weight: 800; font-size: 20px; font-variant-numeric: tabular-nums; }
.run-summary .k { font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-faint); }

.logstream {
  font-family: var(--mono); font-size: 11.5px; line-height: 1.75;
  background: var(--ink); border: 1px solid var(--line); border-radius: 8px;
  padding: 12px; max-height: 300px; overflow: auto;
}
.logline { display: grid; grid-template-columns: 62px 92px 1fr; gap: 10px; padding: 1px 0; }
.logline .lvl { font-weight: 600; }
.logline .stage { color: var(--text-faint); }
.lvl-Info { color: var(--slate); }
.lvl-Warn { color: var(--amber); }
.lvl-Error, .lvl-Fatal { color: var(--rose); }
.logline .msg { color: var(--text-dim); word-break: break-word; }

.tx-row { animation: rise 260ms ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .tx-row { animation: none; }
  * { transition-duration: 1ms !important; }
}

/* -------------------------------------------------------------- match */
.match-card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); overflow: hidden; }
.match-head { padding: 12px 15px; border-bottom: 1px solid var(--line-soft); display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.score {
  font-family: var(--display); font-weight: 800; font-size: 24px; letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.compare { display: grid; grid-template-columns: 128px 1fr 1fr; gap: 0; font-size: 13px; }
.compare > div { padding: 7px 13px; border-bottom: 1px solid var(--line-soft); }
.compare .rowlabel { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-faint); }
.compare .agree { color: var(--text); }
.compare .differ { color: var(--amber); }
.featbar { height: 5px; border-radius: 3px; background: var(--panel-3); overflow: hidden; }
.featbar i { display: block; height: 100%; background: var(--teal-deep); border-radius: 3px; }
.featbar i.low { background: var(--amber-deep); }

/* --------------------------------------------------------------- misc */
.callout { border-left: 2px solid var(--amber); padding: 2px 0 2px 15px; color: var(--text-dim); margin-top: 14px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: 13px; }
.kv dt { font-family: var(--mono); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-faint); }
.kv dd { margin: 0; color: var(--text-dim); }
pre.json {
  font-family: var(--mono); font-size: 11.5px; line-height: 1.6;
  background: var(--ink); border: 1px solid var(--line); border-radius: 8px;
  padding: 12px; overflow: auto; max-height: 340px; margin: 0; color: var(--text-dim);
}
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-family: var(--mono); font-size: 11.5px; color: var(--text-dim); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.swatch { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }

footer { border-top: 1px solid var(--line-soft); padding-block: 34px 46px; color: var(--text-faint); font-size: 13px; }

@media (max-width: 620px) {
  .compare { grid-template-columns: 1fr; }
  .compare .rowlabel { padding-bottom: 0; border-bottom: none; }
  .logline { grid-template-columns: 52px 1fr; }
  .logline .stage { display: none; }
}
