:root {
  --bg: #ffffff;
  --fg: #111111;
  --muted: #777777;
  --line: #e6e6e6;
  --line-strong: #111111;
  --pad: 32px;
  --mono: "SF Mono", "Cascadia Code", Consolas, "Courier New", monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* ── login ─────────────────────────────────────────── */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-card {
  width: 360px;
  border: 1px solid var(--line-strong);
  padding: 48px 40px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.brand {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0.14em;
}
.brand-sub {
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  margin-bottom: 28px;
}
.login-error { color: #b00020; font-size: 13px; margin-top: 10px; }

/* ── header / tabs ─────────────────────────────────── */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px var(--pad);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 10;
}
.header-left { display: flex; align-items: center; gap: 16px; }
.brand.small { font-size: 18px; }
.badge {
  font-family: var(--mono);
  font-size: 12px;
  padding: 4px 10px;
  border: 1px solid var(--line-strong);
  max-width: 480px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.badge.running { background: var(--fg); color: var(--bg); }

.tabs {
  display: flex;
  gap: 4px;
  padding: 0 var(--pad);
  border-bottom: 1px solid var(--line);
}
.tab {
  appearance: none;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 14px 18px;
  font: inherit;
  font-size: 14px;
  color: var(--muted);
  cursor: pointer;
}
.tab:hover { color: var(--fg); }
.tab.active {
  color: var(--fg);
  border-bottom-color: var(--fg);
  font-weight: 600;
}

.content { padding: var(--pad); max-width: 1060px; }
.tabpane { display: none; }
.tabpane.active { display: block; }

/* ── cards ─────────────────────────────────────────── */
.card {
  border: 1px solid var(--line);
  padding: 28px;
  margin-bottom: 24px;
}
.card-title {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 20px;
}

/* ── stats ─────────────────────────────────────────── */
.grid { display: grid; gap: 24px; margin-bottom: 24px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.stat {
  border: 1px solid var(--line);
  padding: 24px;
}
.stat-num {
  font-family: var(--mono);
  font-size: 34px;
  font-weight: 500;
  line-height: 1.1;
}
.stat-label {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-top: 8px;
}

/* ── forms ─────────────────────────────────────────── */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}
.span-2 { grid-column: span 2; }
.label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}
.input {
  width: 100%;
  border: 1px solid var(--line-strong);
  background: var(--bg);
  color: var(--fg);
  font: inherit;
  padding: 10px 14px;
  outline: none;
}
.input:focus { box-shadow: 0 0 0 2px rgba(17,17,17,0.12); }
.textarea { resize: vertical; font-family: var(--mono); font-size: 13px; }
select.input { cursor: pointer; }

.checks { display: flex; gap: 28px; margin-top: 20px; flex-wrap: wrap; }
.check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  cursor: pointer;
  user-select: none;
}
.check input { accent-color: #111; width: 16px; height: 16px; cursor: pointer; }

/* ── buttons ───────────────────────────────────────── */
.btn {
  appearance: none;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  padding: 11px 26px;
  cursor: pointer;
  border: 1px solid var(--line-strong);
  transition: background 0.15s, color 0.15s;
}
.btn:disabled { opacity: 0.35; cursor: not-allowed; }
.btn-black { background: var(--fg); color: var(--bg); }
.btn-black:hover:not(:disabled) { background: var(--bg); color: var(--fg); }
.btn-outline { background: var(--bg); color: var(--fg); }
.btn-outline:hover:not(:disabled) { background: var(--fg); color: var(--bg); }
.btn-ghost { background: none; border-color: transparent; color: var(--muted); padding: 8px 12px; }
.btn-ghost:hover { color: var(--fg); border-color: var(--line-strong); }
.btn-wide { width: 100%; margin-top: 20px; }
.row-gap { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.top-gap { margin-top: 24px; }
.hint { color: var(--muted); font-size: 13px; }

/* ── file list ─────────────────────────────────────── */
.file-list { display: flex; flex-direction: column; }
.file-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 4px;
  border-bottom: 1px solid var(--line);
}
.file-row:last-child { border-bottom: none; }
.file-name { font-family: var(--mono); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-meta { color: var(--muted); font-size: 13px; font-family: var(--mono); white-space: nowrap; }
.file-actions { display: flex; gap: 10px; }
.btn-tiny {
  font: inherit; font-size: 12px; padding: 6px 14px;
  border: 1px solid var(--line-strong); background: var(--bg); cursor: pointer;
}
.btn-tiny:hover { background: var(--fg); color: var(--bg); }

/* ── log ───────────────────────────────────────────── */
.log {
  background: var(--fg);
  color: #e8e8e8;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.75;
  padding: 24px;
  min-height: 320px;
  max-height: 620px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
}
.log .empty { color: #888; }

/* ── toast ─────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--fg);
  color: var(--bg);
  padding: 12px 24px;
  font-size: 14px;
  z-index: 100;
  max-width: 80vw;
}
.toast.error { background: #b00020; color: #fff; }

@media (max-width: 900px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .form-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: span 1; }
  .content { padding: 20px; }
}
