:root {
  --bg: #f5f6f8; --surface: #ffffff; --surface-2: #f0f2f5; --text: #1b1f24; --muted: #66707c; --border: #dde1e6;
  --accent: #f26b1d; --accent-text: #ffffff; --ok: #1f9d55; --warn: #c58a00; --bad: #d13b3b; --info: #2f6fdd;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
}
[data-theme="dark"] {
  --bg: #0f1216; --surface: #171b21; --surface-2: #1f252d; --text: #e6e9ee; --muted: #98a2ae; --border: #2a313a;
  --accent: #ff8a3d; --accent-text: #15110d; --ok: #3ccf7a; --warn: #e6b23c; --bad: #ff6b6b; --info: #6ea2ff;
  --shadow: none;
}
* { 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; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.error { color: var(--bad); min-height: 1em; }
.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 16px; padding: 10px 24px;
  background: var(--surface); border-bottom: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; font-size: 17px; }
.sysinfo { flex: 1; display: flex; gap: 14px; color: var(--muted); font-size: 12.5px; flex-wrap: wrap; }
.sysinfo b { color: var(--text); font-weight: 600; }
.top-actions { display: flex; gap: 8px; }
main { max-width: 1180px; margin: 24px auto; padding: 0 20px; display: grid; gap: 20px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 18px 20px;
  box-shadow: var(--shadow); }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 10px; }
h1, h2, h3 { margin: 0; font-weight: 650; }
h2 { font-size: 16px; } h3 { font-size: 15px; }
.btn { border: 1px solid var(--border); background: var(--surface-2); color: var(--text); border-radius: 8px;
  padding: 7px 13px; font: inherit; cursor: pointer; text-decoration: none; white-space: nowrap; display: inline-block; }
.btn:hover { filter: brightness(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 600; }
.btn-ghost { background: transparent; }
.btn-danger { color: var(--bad); }
.btn-viewer { background: var(--ok); border-color: var(--ok); color: #fff; font-weight: 600; }
.btn-sm { padding: 4px 9px; font-size: 12.5px; }
input, select { width: 100%; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; }
label { display: grid; gap: 5px; font-weight: 550; font-size: 13px; }
.login-card { max-width: 400px; margin: 80px auto; display: grid; gap: 12px; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; text-transform: uppercase;
  letter-spacing: .03em; padding: 8px 8px; border-bottom: 1px solid var(--border); }
.table td { padding: 9px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table td.actions { text-align: right; display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px; font-size: 12px;
  font-weight: 600; background: var(--surface-2); color: var(--muted); }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.ok { color: var(--ok); } .badge.bad { color: var(--bad); } .badge.warn { color: var(--warn); }
.badge.info { color: var(--info); }
.badge.live::before { animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .25; } }
.dataset-form { display: grid; gap: 14px; padding: 14px; margin-bottom: 14px; border: 1px dashed var(--border);
  border-radius: 10px; background: var(--surface-2); }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 9px; overflow: hidden; width: fit-content;
  flex-wrap: wrap; }
.seg button { border: 0; background: var(--surface); color: var(--text); padding: 7px 13px; font: inherit; cursor: pointer;
  border-right: 1px solid var(--border); }
.seg button:last-child { border-right: 0; }
.seg button.active { background: var(--accent); color: var(--accent-text); font-weight: 600; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.drop { border: 2px dashed var(--border); border-radius: 10px; padding: 16px; text-align: center; background: var(--surface); }
.drop.over { border-color: var(--accent); }
.drop input { border: 0; padding: 0; width: auto; }
.form-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.progress { position: relative; height: 22px; border-radius: 6px; background: var(--surface); border: 1px solid var(--border);
  overflow: hidden; }
.progress div { height: 100%; width: 0; background: var(--accent); opacity: .85; transition: width .2s; }
.progress span { position: absolute; inset: 0; display: grid; place-items: center; font-size: 12px; font-weight: 600; }
.run { display: grid; grid-template-columns: 1fr auto; gap: 8px 16px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.run:last-child { border-bottom: 0; }
.run-title { font-weight: 600; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.run-meta { color: var(--muted); font-size: 12.5px; }
.run-actions { display: flex; gap: 6px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.run .bar { grid-column: 1 / -1; height: 6px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.run .bar div { height: 100%; background: var(--accent); }
.files { grid-column: 1 / -1; display: flex; gap: 8px; flex-wrap: wrap; font-size: 12.5px; }
.files a { color: var(--info); }
.empty { text-align: center; padding: 16px; }
dialog { border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text);
  padding: 20px; width: min(460px, 92vw); }
dialog.wide { width: min(1000px, 94vw); }
dialog::backdrop { background: rgba(0, 0, 0, .45); }
dialog form { display: grid; gap: 12px; }
pre#log-text { background: #0b0d10; color: #d7dde5; padding: 12px; border-radius: 8px; height: 60vh; overflow: auto;
  font: 12px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre-wrap; word-break: break-all; }
@media (max-width: 720px) { .topbar { flex-wrap: wrap; } .run { grid-template-columns: 1fr; } .run-actions { justify-content: flex-start; } }
