:root {
  --bg: #fafafa;
  --card: #fff;
  --line: #ececec;
  --text: #2c2c2c;
  --muted: #9a9a9a;
  --accent: #2563eb;
  --ok: #16a34a;
  --warn: #d97706;
  --err: #dc2626;
  --chip-pending: #eef2ff;
  --chip-running: #fef9c3;
  --chip-done: #dcfce7;
  --chip-failed: #fee2e2;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "PingFang SC", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
}
#app {
  max-width: 640px;
  margin: 0 auto;
  padding: env(safe-area-inset-top) 16px calc(80px + env(safe-area-inset-bottom));
}
h1 { font-size: 20px; font-weight: 600; margin: 16px 0 8px; letter-spacing: -0.01em; }
h2 { font-size: 16px; font-weight: 600; margin: 20px 0 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; font-size: 12px; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 10px;
}
.muted { color: var(--muted); font-size: 13px; }
label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 4px; }
input, select, textarea, button {
  font: inherit;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: white;
  color: var(--text);
}
textarea { min-height: 88px; resize: vertical; }
button {
  background: var(--accent);
  color: white;
  border: none;
  font-weight: 600;
  margin-top: 12px;
  cursor: pointer;
}
button.ghost { background: white; color: var(--accent); border: 1px solid var(--accent); font-weight: 500; }
button:disabled { opacity: 0.5; cursor: not-allowed; }
.chip {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
}
.chip-pending { background: var(--chip-pending); color: #4338ca; }
.chip-running { background: var(--chip-running); color: #a16207; }
.chip-done { background: var(--chip-done); color: #15803d; }
.chip-failed { background: var(--chip-failed); color: #b91c1c; }

.job-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-bottom: 8px;
  cursor: pointer;
}
.job-row:active { background: #f5f5f5; }
.job-title { font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }

.log-box {
  background: #1a1a1a;
  color: #d4d4d4;
  border-radius: 10px;
  padding: 12px 14px;
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 70vh;
  overflow-y: auto;
  border: 1px solid #2a2a2a;
  position: relative;
}
.log-toolbar {
  position: sticky; top: 0;
  display: flex; gap: 8px; align-items: center;
  padding: 4px 0 8px;
  background: linear-gradient(#1a1a1a 80%, transparent);
  font-size: 11px;
  color: #888;
}
.log-toolbar .pill {
  padding: 2px 8px; border-radius: 999px; background: #2a2a2a;
}
.log-toolbar .pill.live { background: #14532d; color: #86efac; }
.log-toolbar button {
  background: #2a2a2a; color: #ddd; border: 1px solid #3a3a3a;
  padding: 3px 10px; font-size: 11px; border-radius: 6px;
  cursor: pointer; width: auto; margin: 0;
}
.log-toolbar button.active { background: #1e3a8a; color: white; border-color: #2563eb; }

.log-line {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 12px;
  padding: 1px 0;
}
.log-line.section-start { border-top: 1px dashed #333; margin-top: 6px; padding-top: 6px; }
.log-ts {
  color: #6b7280;
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  white-space: nowrap;
}
.log-info { color: #d4d4d4; }
.log-head { color: #60a5fa; font-weight: 600; }
.log-ok   { color: #34d399; font-weight: 500; }
.log-warn { color: #fbbf24; }
.log-err  { color: #f87171; font-weight: 500; }

.nav-bar {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: rgba(250,250,250,0.9);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  display: flex; gap: 10px;
}
.nav-bar button { margin: 0; }

.template-chip {
  display: inline-block;
  background: #f3f4f6;
  padding: 6px 12px;
  border-radius: 999px;
  margin: 0 6px 8px 0;
  font-size: 13px;
  cursor: pointer;
  border: 1px solid transparent;
}
.template-chip:active { background: #e5e7eb; }

.empty-state { text-align: center; padding: 40px 20px; color: var(--muted); }
