@font-face { font-family: Geist; src: url(/static/fonts/g4.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: Geist; src: url(/static/fonts/g2.woff2) format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: Geist; src: url(/static/fonts/g0.woff2) format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Geist Mono"; src: url(/static/fonts/g21.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Geist Mono"; src: url(/static/fonts/g22.woff2) format("woff2"); font-weight: 500; font-display: swap; }

:root {
  --bg: #ffffff;
  --canvas: #fafafa;
  --ink: #171717;
  --muted: #666666;
  --faint: #808080;
  --line: rgba(0,0,0,0.08);
  --navy: #0a2348;
  --navy-mid: #1d4e89;
  --ok: #0f6b3c;
  --ok-bg: #edf3ec;
  --bad: #9f2f2d;
  --bad-bg: #fdebec;
  --warn: #956400;
  --warn-bg: #fbf3db;
  --font: Geist, ui-sans-serif, system-ui, sans-serif;
  --mono: "Geist Mono", ui-monospace, Menlo, monospace;
  --shadow: rgba(0,0,0,0.08) 0 0 0 1px, rgba(0,0,0,0.04) 0 2px 2px, #fafafa 0 0 0 1px;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  display: flex;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.45;
  font-feature-settings: "liga";
}
button, input, select, textarea { font: inherit; color: inherit; }
button:focus, input:focus, select:focus, textarea:focus { outline: none; }
[hidden] { display: none !important; }

.rail {
  width: 248px;
  flex-shrink: 0;
  background: var(--bg);
  border-right: 0;
  box-shadow: rgba(0,0,0,0.08) 1px 0 0 0;
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
  gap: 4px;
}
.brand { display: flex; gap: 10px; align-items: center; padding: 4px 8px 16px; }
.brand strong { display: block; font-size: 15px; font-weight: 600; letter-spacing: -0.32px; }
.brand small { color: var(--muted); font-size: 12px; font-weight: 400; }
.mark {
  width: 22px; height: 22px; border-radius: 5px;
  background: var(--navy);
}
.field-label, .nav-label {
  font-size: 11px; font-weight: 600; letter-spacing: 1.1px;
  text-transform: uppercase; color: var(--faint);
  margin: 12px 8px 6px;
}
.rail select {
  width: calc(100% - 8px); margin: 0 4px;
  background: var(--canvas); color: var(--ink);
  border: 0; box-shadow: rgba(0,0,0,0.08) 0 0 0 1px;
  border-radius: 6px; padding: 8px 10px;
}
.rail select:focus { box-shadow: var(--navy-mid) 0 0 0 1px; }
#pipe-list { flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: 2px; padding: 0 4px; }
.pipe {
  text-align: left; background: transparent; border: 0; color: var(--ink);
  padding: 9px 10px; border-radius: 6px; cursor: pointer;
}
.pipe:hover { background: var(--canvas); }
.pipe.on { background: #0a2348; color: #fff; }
.pipe.on span { color: #c5d0dc; }
.pipe span { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; font-family: var(--mono); }
.rail-foot { font-size: 11px; color: var(--faint); margin: 8px 8px 0; font-family: var(--mono); }

.workspace { flex: 1; min-width: 0; display: flex; flex-direction: column; min-height: 0; background: var(--canvas); }
.top {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 0 20px;
  background: var(--bg);
  box-shadow: rgba(0,0,0,0.08) 0 1px 0 0;
  min-height: 56px;
}
.top-left { min-width: 180px; padding: 10px 0; }
h1 { font-size: 16px; margin: 0; font-weight: 600; letter-spacing: -0.32px; }
.sub { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.tabs { display: flex; gap: 2px; flex: 1; overflow-x: auto; }
.tabs button {
  background: none; border: 0; border-bottom: 2px solid transparent;
  padding: 16px 10px 14px; color: var(--muted); cursor: pointer; white-space: nowrap;
  font-weight: 500; font-size: 13px;
}
.tabs button.on { color: var(--ink); border-bottom-color: var(--navy); }
.top-actions { display: flex; gap: 8px; }
.btn {
  background: var(--bg); border: 0;
  box-shadow: rgb(235,235,235) 0 0 0 1px;
  border-radius: 6px; padding: 7px 12px; cursor: pointer; font-weight: 500; font-size: 13px;
}
.btn:hover { background: var(--canvas); }
.btn:active { transform: scale(0.98); }
.btn.primary { background: var(--ink); color: #fff; box-shadow: none; }
.btn.primary:hover { background: #333; }
.btn:focus { box-shadow: var(--navy-mid) 0 0 0 1px; }
.btn:disabled { color: #9aa1a8; background: #f3f3f3; cursor: not-allowed; transform: none; }

.page { display: none; flex: 1; min-height: 0; }
.page.on { display: flex; flex-direction: column; }
.graph-wrap { display: flex; flex: 1; min-height: 0; }
.dag {
  flex: 1; min-width: 0; overflow: auto; padding: 28px;
  background: var(--canvas);
}
.inspector {
  width: 340px; flex-shrink: 0; background: var(--bg);
  box-shadow: rgba(0,0,0,0.08) -1px 0 0 0;
  padding: 20px; overflow: auto;
}
.empty, .muted { color: var(--muted); }
.kicker {
  font-size: 11px; font-weight: 600; letter-spacing: 1.1px;
  text-transform: uppercase; color: var(--navy-mid); margin: 0;
}
.inspector h2 { font-size: 18px; margin: 6px 0 8px; font-weight: 600; letter-spacing: -0.4px; }
.insp-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 14px 0; }
.insp-tabs button {
  background: none; border: 0; box-shadow: rgb(235,235,235) 0 0 0 1px;
  border-radius: 6px; padding: 5px 9px; font-size: 12px; font-weight: 500;
  cursor: pointer; color: var(--muted);
}
.insp-tabs button.on { color: var(--ink); box-shadow: var(--navy) 0 0 0 1px; }
.itab { display: none; }
.itab.on { display: block; }
pre {
  background: var(--canvas);
  box-shadow: rgba(0,0,0,0.08) 0 0 0 1px;
  border-radius: 8px; padding: 12px; overflow: auto;
  font-family: var(--mono); font-size: 12px; white-space: pre-wrap;
}
.insp-actions { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.chip-row { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  font-size: 11px; font-weight: 500; padding: 2px 8px; border-radius: 999px;
  background: #ebf5ff; color: #0068d6;
}
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.stat {
  background: var(--canvas); border-radius: 8px; padding: 12px;
  box-shadow: rgba(0,0,0,0.08) 0 0 0 1px;
}
.stat b { display: block; font-size: 20px; font-weight: 600; letter-spacing: -0.5px; }
.stat span { color: var(--muted); font-size: 12px; }

.node { fill: #fff; stroke: rgba(0,0,0,0.12); stroke-width: 1; }
.node.sel { stroke: var(--navy); stroke-width: 1.6; }
.node-label { font-size: 13px; font-family: var(--font); font-weight: 500; fill: var(--ink); }
.node-type { font-size: 10px; fill: var(--muted); font-family: var(--font); font-weight: 600; letter-spacing: 0.8px; }
.edge { stroke: #d4d4d4; fill: none; stroke-width: 1.4; }

.panel { padding: 24px; overflow: auto; flex: 1; }
.table { width: 100%; border-collapse: collapse; background: var(--bg); box-shadow: var(--shadow); border-radius: 8px; overflow: hidden; }
.table th, .table td { text-align: left; padding: 10px 12px; box-shadow: inset 0 -1px 0 var(--line); font-size: 13px; }
.table th { color: var(--muted); font-weight: 600; font-size: 11px; letter-spacing: 0.8px; text-transform: uppercase; }
.badge { font-size: 11px; font-weight: 500; padding: 2px 8px; border-radius: 999px; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; max-width: 880px; }
.form-grid label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted); font-weight: 500; }
.form-grid input, .form-grid textarea, .form-grid select,
.drawer-card input, .drawer-card select, .drawer-card textarea {
  border: 0; box-shadow: rgba(0,0,0,0.08) 0 0 0 1px; border-radius: 6px; padding: 9px 11px; background: #fff;
}
.form-grid input:focus, .form-grid textarea:focus, .drawer-card input:focus, .drawer-card select:focus {
  box-shadow: var(--navy-mid) 0 0 0 1px;
}
.span2 { grid-column: 1 / -1; }
.drawer {
  position: fixed; inset: 0; background: rgba(23,23,23,0.32);
  display: flex; align-items: flex-start; justify-content: flex-end; z-index: 40;
}
.drawer-card {
  width: 400px; max-width: 100%; height: 100%; background: var(--bg);
  padding: 24px; overflow: auto; display: flex; flex-direction: column; gap: 12px;
}
.drawer-card.wide { width: min(740px, 100%); }
.drawer-card h2 { margin: 0; font-size: 18px; letter-spacing: -0.4px; }
.drawer-card label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); font-weight: 500; }
.cli-form { display: none; margin-top: 16px; }
.cli-form.on { display: block; }
.cli-panel .form-grid { max-width: none; }
.check { flex-direction: row !important; align-items: center; gap: 8px !important; color: var(--ink) !important; }
.drawer-actions { display: flex; gap: 8px; margin-top: auto; justify-content: flex-end; }
.log { min-height: 180px; max-height: 60vh; }
.issue { box-shadow: var(--shadow); border-radius: 8px; padding: 12px 14px; margin: 8px 0; background: #fff; }
.issue.err { background: var(--bad-bg); }
.issue.warn { background: var(--warn-bg); }
.subtabs { display: flex; gap: 4px; margin-bottom: 16px; }
.subtabs button {
  background: none; border: 0; box-shadow: rgb(235,235,235) 0 0 0 1px;
  border-radius: 6px; padding: 6px 10px; font-size: 13px; font-weight: 500;
  cursor: pointer; color: var(--muted);
}
.subtabs button.on { color: var(--ink); box-shadow: var(--navy) 0 0 0 1px; }
#graph-alert {
  margin: 12px 20px 0; padding: 10px 14px; border-radius: 8px; font-size: 13px;
  background: var(--canvas);
}
#graph-alert.ok { background: var(--ok-bg); color: var(--ok); }
#graph-alert.bad { background: var(--bad-bg); color: var(--bad); }
#graph-alert .issue-link {
  display: block; width: 100%; text-align: left; background: none; border: 0;
  padding: 8px 0; cursor: pointer; color: inherit; font: inherit;
}
.dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: #d4d4d4; margin-right: 8px; vertical-align: middle; flex-shrink: 0;
}
.dot.ok { background: var(--ok); }
.dot.bad { background: var(--bad); }
.dot.warn { background: var(--warn); }
.pipe-name { display: flex; align-items: center; }
.node.ok { stroke: var(--ok); }
.node.bad { stroke: var(--bad); }
.ndot { fill: #d4d4d4; }
.ndot.ok { fill: var(--ok); }
.ndot.bad { fill: var(--bad); }
.legend { display: flex; gap: 16px; font-size: 12px; color: var(--muted); margin-bottom: 8px; align-items: center; }
.win-list { margin: 8px 0 0; padding-left: 18px; font-size: 13px; color: var(--ink); }
@media (max-width: 900px) {
  body { flex-direction: column; }
  .rail { width: 100%; flex-direction: row; flex-wrap: wrap; height: auto; }
  #pipe-list { flex-direction: row; width: 100%; }
  .graph-wrap { flex-direction: column; }
  .inspector { width: 100%; max-height: 46vh; }
  .tabs button { padding: 10px 8px; font-size: 12px; }
  .rail-foot { display: none; }
  .top-actions { width: 100%; justify-content: flex-end; padding-bottom: 10px; }
  .top { flex-wrap: wrap; }
}
