:root {
  /* light (default) */
  --bg: #f3f5f9; --surface: #ffffff; --surface-2: #eef2f7; --border: #d9dfe8; --text: #15213a; --muted: #5b6b8a;
  --accent: #2563eb; --accent-soft: rgba(37,99,235,.12); --on-accent: #ffffff; --ok: #059669; --bad: #dc2626; --warn: #d97706;
  --shadow: 0 10px 30px rgba(15,23,42,.12); --mono: ui-monospace, Consolas, Menlo, monospace;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0b1020; --surface: #121a2e; --surface-2: #1a2440; --border: #263251; --text: #e6ecf5; --muted: #8b9ac2;
  --accent: #60a5fa; --accent-soft: rgba(96,165,250,.15); --on-accent: #0b1020; --ok: #34d399; --bad: #f87171; --warn: #fbbf24;
  --shadow: 0 10px 30px rgba(0,0,0,.4);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 system-ui, -apple-system, Segoe UI, Roboto, sans-serif; }
a { color: var(--accent); text-decoration: none; }
header#top { display: flex; align-items: center; gap: 20px; padding: 10px 18px; border-bottom: 1px solid var(--border); background: var(--surface); position: sticky; top: 0; z-index: 10; }
.brand { color: var(--text); font-weight: 600; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.brand .flask { color: var(--accent); font-size: 20px; }
.brand .node { color: var(--muted); font-weight: 400; font-family: var(--mono); font-size: 12px; background: var(--surface-2); padding: 2px 8px; border-radius: 999px; }
nav#nav { display: flex; gap: 4px; margin-left: 10px; }
nav#nav a { padding: 6px 12px; border-radius: 8px; color: var(--muted); }
nav#nav a.active, nav#nav a:hover { background: var(--surface-2); color: var(--text); }
nav#nav a.primary { background: var(--accent); color: var(--on-accent); font-weight: 600; }
#who { margin-left: auto; color: var(--muted); font-size: 13px; display: flex; gap: 10px; align-items: center; }
main#app { max-width: 1400px; margin: 0 auto; padding: 18px; }
h1 { font-size: 22px; margin: 0 0 14px; font-weight: 600; }
h2 { font-size: 15px; margin: 0 0 10px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px; margin-bottom: 16px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 900px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }
label.f { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); min-width: 140px; }
label.f > span.help { font-size: 11px; color: var(--muted); opacity: .8; }
input, select, textarea, button { font: inherit; color: var(--text); }
input[type=text], input[type=number], input[type=password], input[type=email], select, textarea {
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px; outline: none; width: 100%;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
button, .btn { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 7px 12px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
button:hover, .btn:hover { border-color: var(--accent); }
button.primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); font-weight: 600; }
button.danger { color: var(--bad); }
button.small { padding: 4px 8px; font-size: 12px; }
button:disabled { opacity: .5; cursor: not-allowed; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 8px; border-bottom: 1px solid var(--border); }
td { padding: 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
tr:hover td { background: var(--surface-2); }
.pill { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 2px 10px; font-size: 12px; border: 1px solid var(--border); background: var(--surface-2); }
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.pill.running .dot { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.pill.starting .dot { background: var(--warn); }
.pill.failed .dot { background: var(--bad); }
.pill.finished .dot, .pill.stopped .dot { background: var(--muted); }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: 12px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 12px; }
.tabs button { background: none; border: none; border-bottom: 2px solid transparent; border-radius: 0; color: var(--muted); padding: 8px 12px; }
.tabs button.active { color: var(--text); border-bottom-color: var(--accent); }
#toast { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 50; }
#toast .t { background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--accent); padding: 10px 14px; border-radius: 8px; max-width: 420px; box-shadow: var(--shadow); }
#toast .t.bad { border-left-color: var(--bad); }
#toast .t.ok { border-left-color: var(--ok); }
.login { max-width: 380px; margin: 80px auto; }
.login h1 { text-align: center; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-family: var(--mono); font-size: 12px; word-break: break-all; }
pre.log { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 10px; max-height: 360px; overflow: auto; font-size: 12px; white-space: pre-wrap; }
.events { max-height: 420px; overflow: auto; font-family: var(--mono); font-size: 12px; }
.events .e { padding: 4px 6px; border-bottom: 1px solid var(--border); display: grid; grid-template-columns: 70px 120px 1fr; gap: 8px; }
.events .e .k { color: var(--accent); }
.counts { font-family: var(--mono); font-size: 12px; white-space: pre-wrap; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 10px; max-height: 300px; overflow: auto; }
video.player { width: 100%; background: #000; border-radius: 10px; aspect-ratio: 16/9; }
.player-wrap { position: relative; }
.player-wrap .badge { position: absolute; top: 10px; left: 10px; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.thumb { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--bg); cursor: pointer; }
.thumb.selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.thumb img { width: 100%; aspect-ratio: 16/9; object-fit: cover; display: block; background: #000; }
.thumb .cap { padding: 6px 8px; font-size: 12px; }
.steps { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.steps .s { padding: 4px 10px; border-radius: 999px; border: 1px solid var(--border); color: var(--muted); font-size: 12px; }
.steps .s.done { border-color: var(--ok); color: var(--ok); }
.steps .s.now { border-color: var(--accent); color: var(--accent); }
/* zone editor */
.ze { display: grid; grid-template-columns: 1fr 320px; gap: 14px; }
@media (max-width: 1000px) { .ze { grid-template-columns: 1fr; } }
.ze canvas { width: 100%; background: #000; border-radius: 10px; cursor: crosshair; display: block; }
.ze .side { display: flex; flex-direction: column; gap: 10px; }
.ze .zlist { display: flex; flex-direction: column; gap: 6px; max-height: 320px; overflow: auto; }
.ze .z { border: 1px solid var(--border); border-radius: 8px; padding: 6px 8px; display: flex; gap: 8px; align-items: center; cursor: pointer; font-size: 12px; }
.ze .z.sel { border-color: var(--accent); background: var(--accent-soft); }
.ze .z .sw { width: 10px; height: 10px; border-radius: 2px; }
.ze .hint { font-size: 12px; color: var(--muted); }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.progress { height: 6px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.progress > div { height: 100%; background: var(--accent); width: 0; transition: width .2s; }
.drop { border: 1px dashed var(--border); border-radius: 10px; padding: 18px; text-align: center; color: var(--muted); }
.drop.over { border-color: var(--accent); background: var(--accent-soft); }

/* theme toggle */
#theme { background: none; border: 1px solid var(--border); border-radius: 999px; padding: 4px 9px; font-size: 13px; line-height: 1; }
