/* ── FuelWorks AI brand system ────────────────────────────────────────────
   Emerald / spring-lime on a green-biased charcoal ground. Mirrors the
   trellis-ui palette (tailwind.config.ts / globals.css). Spring lime is the
   focal accent — reserved for the worker "node" (health) and key stats.
   ─────────────────────────────────────────────────────────────────────── */
:root {
  --bg: #0c120f;            /* ground — page background */
  --panel: #141b17;         /* surface 1 — cards */
  --panel-2: #1a231c;       /* surface 2 — hover / inputs */
  --panel-3: #23332a;       /* surface 3 — elevated */
  --border: #23332a;
  --border-hover: #34493b;
  --text: #edf1ec;          /* ink */
  --muted: #a9b5ac;         /* ink-soft */
  --muted-2: #748075;       /* ink-mute */
  --accent: #10b981;        /* emerald — links, active tab, icons, hover */
  --accent-deep: #065f46;   /* deep emerald — primary buttons / CTA */
  --lime: #bef264;          /* spring lime — focal accent (worker node, stats) */
  --ok: #bef264;            /* healthy worker = the lime node */
  --warn: #d29922;
  --bad: #f87171;           /* poppy — error / critical */

  --font-heading: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-body: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-hover); }
::selection { background: rgba(16, 185, 129, 0.35); color: var(--text); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }

.topbar {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 10px 18px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  color: var(--text);
}
.brand:hover { opacity: 0.9; }
.brand-mark { width: 26px; height: 26px; flex: none; }
.brand-name { font-family: var(--font-heading); font-weight: 700; letter-spacing: -0.01em; }
.brand-type { color: var(--muted); font-size: 12px; }
.brand-type:not(:empty)::before { content: "· "; }
.brand .dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--muted-2);
}
.brand .dot.ok { background: var(--lime); box-shadow: 0 0 6px rgba(190, 242, 100, 0.6); }
.brand .dot.bad { background: var(--bad); }

/* FuelWorks eyebrow — uppercase, tracked, like the trellis-ui nav label */
.brand-eyebrow {
  font-family: var(--font-heading);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted-2);
}

.tabs { display: flex; gap: 2px; flex: 1; justify-content: center; }
.tabs a {
  color: var(--muted);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 6px;
  font-weight: 500;
  font-size: 13px;
}
.tabs a:hover { background: var(--panel-2); color: var(--text); }
.tabs a.active { color: var(--accent); background: rgba(16, 185, 129, 0.1); }

.token-btn {
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 6px 10px;
  cursor: pointer;
}
.token-btn:hover { border-color: var(--border-hover); }

.view { padding: 22px; max-width: 1100px; margin: 0 auto; }

h1 { font-family: var(--font-heading); font-size: 21px; font-weight: 700; letter-spacing: -0.01em; margin: 0 0 4px; }
h2 { font-family: var(--font-heading); font-size: 14px; margin: 22px 0 8px; color: var(--muted); font-weight: 600; letter-spacing: 0.02em; }

.muted { color: var(--muted); }

.banner {
  background: rgba(210, 153, 34, 0.12);
  border: 1px solid rgba(210, 153, 34, 0.4);
  color: #e8c778;
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 16px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 12px;
}

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

.kv { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; border-bottom: 1px dashed var(--border); }
.kv:last-child { border-bottom: 0; }
.kv .k { color: var(--muted); }
.kv .v { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; text-align: right; word-break: break-all; }

.check { display: flex; align-items: center; gap: 10px; }
.badge { font-size: 12px; padding: 2px 8px; border-radius: 20px; font-weight: 600; }
.badge.ok { background: rgba(16,185,129,.15); color: var(--accent); }
.badge.bad { background: rgba(248,113,113,.15); color: var(--bad); }
.badge.immutable { background: rgba(16,185,129,.15); color: var(--accent); }

pre.doc {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  overflow: auto;
  white-space: pre-wrap;
  font-family: var(--font-mono);
  font-size: 13px;
}

.pill-row { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { background: var(--panel-2); border: 1px solid var(--border); border-radius: 20px; padding: 3px 10px; font-size: 12px; }

#graph { height: 70vh; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--border); font-size: 13px; }
th { color: var(--muted); font-weight: 600; }

.msg { border-left: 3px solid var(--border); padding: 4px 12px; margin: 8px 0; }
.msg.user { border-color: var(--accent); }
.msg.assistant { border-color: var(--ok); }
.msg.tool { border-color: var(--warn); }
.msg .role { font-size: 11px; text-transform: uppercase; color: var(--muted); letter-spacing: .04em; }

/* Chat */
.chat-log {
  height: 55vh;
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.chat-msg { display: flex; }
.chat-msg.user { justify-content: flex-end; }
.chat-msg .bubble {
  max-width: 78%;
  padding: 8px 12px;
  border-radius: 12px;
  white-space: pre-wrap;
  word-wrap: break-word;
  line-height: 1.45;
}
.chat-msg.user .bubble {
  background: var(--accent-deep);
  color: var(--text);
  border-bottom-right-radius: 3px;
}
.chat-msg.assistant .bubble {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-bottom-left-radius: 3px;
}
.bubble.typing { color: var(--muted); letter-spacing: 2px; }
.chat-input { display: flex; gap: 8px; margin-top: 12px; align-items: flex-end; }
.chat-input textarea {
  flex: 1;
  resize: none;
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 10px 12px;
  font: inherit;
  max-height: 160px;
}
.chat-input button {
  background: var(--accent-deep);
  color: var(--text);
  border: none;
  border-radius: 8px;
  padding: 10px 20px;
  font-weight: 600;
  cursor: pointer;
}
.chat-input button:hover { background: var(--accent); }
.chat-input button:disabled { opacity: .5; cursor: default; }

.error { color: var(--bad); }
a.link { color: var(--accent); cursor: pointer; text-decoration: none; }
a.link:hover { text-decoration: underline; }

/* ── Jobs panel: buttons, forms ─────────────────────────────────────── */
button.link {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: var(--accent);
  cursor: pointer;
}
button.link:hover { text-decoration: underline; }
.nowrap { white-space: nowrap; }
.btn {
  background: var(--accent-deep);
  color: var(--text);
  border: none;
  border-radius: 6px;
  padding: 7px 14px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.btn:hover { background: var(--accent); }
.card.form .form-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 6px 0;
}
.card.form .form-row label {
  width: 130px;
  flex: none;
  color: var(--muted);
  padding-top: 6px;
}
.card.form input,
.card.form textarea,
.card.form select {
  flex: 1;
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 6px 8px;
  font: inherit;
}
.card.form textarea { resize: vertical; }
