/* Scheduled Workers — application styling. Dark, purple-accented, functional.
   All node positioning is done via inline style ATTRIBUTES set by canvas.js,
   which is why the CSP keeps style-src 'unsafe-inline' (script-src stays 'self'). */
:root {
  --bg: #14101c; --panel: #1c1730; --panel-2: #241d3a; --line: #322a4a;
  --ink: #ece9f5; --muted: #9c93b8; --accent: #7c4dff; --accent-2: #422186;
  --ok: #2ecc71; --warn: #e67e22; --danger: #e74c3c; --radius: 8px;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--ink);
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; font-size: 14px; }
.btn { background: var(--accent-2); color: #fff; border: 1px solid var(--accent);
  border-radius: var(--radius); padding: 7px 12px; cursor: pointer; font-size: 13px; }
.btn:hover { background: var(--accent); }
.btn--small { padding: 4px 10px; font-size: 12px; }
.btn--ghost { background: transparent; border-color: var(--line); color: var(--muted); }
.btn--ghost:hover { color: var(--ink); border-color: var(--accent); }
.btn--danger { background: transparent; border-color: var(--danger); color: var(--danger); }

/* ── Login ─────────────────────────────────────────────────────────────── */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 36px 40px; width: 360px; text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.login-card__brand { display: flex; align-items: center; justify-content: center; gap: 10px;
  font-size: 20px; font-weight: 700; margin-bottom: 8px; }
.login-card__mark { display: inline-grid; place-items: center; width: 34px; height: 34px;
  background: var(--accent-2); border-radius: 8px; }
.login-card__lead { color: var(--muted); margin: 4px 0 22px; }
.login-card__sso { display: block; background: var(--accent-2); color: #fff; text-decoration: none;
  padding: 11px; border-radius: var(--radius); font-weight: 600; border: 1px solid var(--accent); }
.login-card__sso:hover { background: var(--accent); }
.login-card__error { background: rgba(192,57,43,.55); border: 1px solid var(--danger);
  color: #fff; border-radius: var(--radius); padding: 9px; margin-bottom: 16px; font-size: 13px; }
.login-card__hint { color: var(--warn); font-size: 12px; margin-top: 16px; }
.login-card__host { color: var(--muted); font-size: 11px; margin-top: 18px; opacity: .6; }

/* ── App shell ─────────────────────────────────────────────────────────── */
.app-shell { display: flex; height: 100vh; overflow: hidden; }
.app-sidebar { width: 260px; flex: 0 0 260px; background: var(--panel); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; }
.app-sidebar__header { display: flex; align-items: center; justify-content: space-between;
  gap: 8px; padding: 14px; border-bottom: 1px solid var(--line); }
.app-brand { font-weight: 700; font-size: 14px; display: flex; align-items: center; gap: 7px; }
.app-brand__mark { display: inline-grid; place-items: center; width: 26px; height: 26px;
  background: var(--accent-2); border-radius: 6px; }
.pipeline-list { list-style: none; margin: 0; padding: 8px; flex: 1; overflow-y: auto; }
.pipeline-list__empty { color: var(--muted); padding: 12px; font-size: 13px; }
.pipeline-item { padding: 10px 11px; border-radius: var(--radius); cursor: pointer; margin-bottom: 4px;
  border: 1px solid transparent; }
.pipeline-item:hover { background: var(--panel-2); }
.pipeline-item--active { background: var(--panel-2); border-color: var(--accent); }
.pipeline-item__name { font-weight: 600; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pipeline-item__meta { color: var(--muted); font-size: 11px; }
.app-sidebar__footer { padding: 12px 14px; border-top: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; }
.app-host { color: var(--muted); font-size: 11px; }
.logout-form { margin: 0; }

.app-main { flex: 1; display: flex; flex-direction: column; position: relative; min-width: 0; }
.app-topbar { display: flex; align-items: center; gap: 14px; padding: 10px 16px;
  background: var(--panel); border-bottom: 1px solid var(--line); }
.app-topbar__title { font-weight: 600; }
.app-topbar__actions { display: flex; gap: 8px; margin-left: auto; }
.app-topbar__status { color: var(--muted); font-size: 12px; min-width: 90px; text-align: right; }

/* ── Canvas ────────────────────────────────────────────────────────────── */
.app-canvas { flex: 1; position: relative; overflow: hidden; cursor: grab;
  background-image: radial-gradient(var(--line) 1px, transparent 1px); background-size: 26px 26px; }
.app-canvas.is-panning { cursor: grabbing; }
.canvas-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); }
.canvas-wires { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.canvas-wires path { stroke: var(--accent); stroke-width: 2; fill: none; }
.canvas-wires path.is-temp { stroke-dasharray: 5 4; opacity: .7; }
.canvas-nodes { position: absolute; inset: 0; transform-origin: 0 0; }
.node { position: absolute; width: 200px; background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 10px; box-shadow: 0 6px 18px rgba(0,0,0,.4); user-select: none; }
.node.is-selected { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(124,77,255,.4); }
.node.is-dangerous { border-left: 3px solid var(--warn); }
.node__head { padding: 8px 10px; cursor: move; display: flex; align-items: center; gap: 7px;
  border-bottom: 1px solid var(--line); }
.node__cat { font-size: 10px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.node__title { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.node__body { padding: 8px 10px; color: var(--muted); font-size: 12px; min-height: 18px; }
.node__port { position: absolute; width: 13px; height: 13px; border-radius: 50%; background: var(--accent);
  border: 2px solid var(--panel); cursor: crosshair; }
.node__port--out { right: -7px; top: 50%; transform: translateY(-50%); }
.node__port--in { left: -7px; top: 50%; transform: translateY(-50%); }

/* ── Inspector ─────────────────────────────────────────────────────────── */
.app-inspector { position: absolute; top: 52px; right: 0; bottom: 0; width: 320px;
  background: var(--panel); border-left: 1px solid var(--line); padding: 16px; overflow-y: auto; }
.insp-field { margin-bottom: 14px; }
.insp-field label { display: block; color: var(--muted); font-size: 12px; margin-bottom: 5px; }
.insp-field input, .insp-field textarea, .insp-field select { width: 100%; background: var(--bg);
  border: 1px solid var(--line); border-radius: 6px; color: var(--ink); padding: 8px; font: inherit; }
.insp-field textarea { min-height: 90px; resize: vertical; }
.insp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.insp-head h3 { margin: 0; font-size: 15px; }

/* ── Palette ───────────────────────────────────────────────────────────── */
.palette { position: absolute; z-index: 20; background: var(--panel); border: 1px solid var(--accent);
  border-radius: 10px; padding: 6px; width: 240px; box-shadow: 0 16px 44px rgba(0,0,0,.6); }
.palette__group { color: var(--muted); font-size: 10px; text-transform: uppercase; padding: 6px 8px 2px; }
.palette__item { padding: 8px; border-radius: 6px; cursor: pointer; }
.palette__item:hover { background: var(--panel-2); }
.palette__item b { display: block; font-size: 13px; }
.palette__item span { color: var(--muted); font-size: 11px; }
