:root {
  --bg: #0b0e14;
  --panel: #121622;
  --panel-border: #212736;
  --text: #e7eaf2;
  --muted: #8b93a7;
  --accent: #5b8cff;
  --green: #35d08f;
  --red: #ff5d6c;
  --yellow: #ffb648;
  --radius: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 20px 60px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.brand h1 {
  font-size: 20px;
  margin: 0;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.brand-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(91, 140, 255, 0.18);
  display: inline-block;
}

.muted { color: var(--muted); font-size: 13px; }

.power {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  padding: 8px 14px;
  border-radius: 999px;
}

.power-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.switch {
  width: 46px;
  height: 26px;
  border-radius: 999px;
  background: #353d52;
  border: none;
  position: relative;
  cursor: pointer;
  transition: background 0.2s ease;
  padding: 0;
}

.switch[aria-checked="true"] { background: var(--green); }
.switch[disabled] { opacity: 0.5; cursor: not-allowed; }

.switch .knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: white;
  transition: left 0.2s ease;
}

.switch[aria-checked="true"] .knob { left: 23px; }

.cards {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 16px;
}

.card-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.card-value { font-size: 26px; font-weight: 700; margin-top: 6px; }
.card-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

.grid {
  display: grid;
  grid-template-columns: minmax(0, 420px) minmax(0, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 20px;
  min-width: 0;
  max-width: 100%;
}

.panel h2 {
  margin: 0 0 14px;
  font-size: 15px;
  font-weight: 700;
}

.form { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.form label { font-size: 12px; color: var(--muted); display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-hint { font-size: 11px; line-height: 1.35; color: var(--muted); overflow-wrap: break-word; }
.form .row { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.form .row label { flex: none; width: 100%; }

input[type="text"], input[type="number"], textarea {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  background: #0e1119;
  border: 1px solid var(--panel-border);
  color: var(--text);
  border-radius: 8px;
  padding: 9px 10px;
  font-size: 14px;
}

textarea { resize: vertical; min-height: 72px; font-family: inherit; line-height: 1.4; }
input[type="text"]:focus, input[type="number"]:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.checkboxes { align-items: flex-start; }
.checkbox {
  flex-direction: row !important;
  align-items: center;
  gap: 7px !important;
  color: var(--text) !important;
  font-size: 13px !important;
}
.checkbox input { width: 15px; height: 15px; }

.actions { display: flex; gap: 10px; margin-top: 4px; }

.btn {
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: filter 0.15s ease, opacity 0.15s ease;
}
.btn:hover { filter: brightness(1.08); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-primary { background: var(--accent); color: white; flex: 1; }
.btn-danger { background: var(--red); color: white; }
.btn-ghost { background: transparent; color: var(--muted); border: 1px solid var(--panel-border); }

.hint { font-size: 12px; color: var(--yellow); min-height: 16px; margin: 2px 0 0; }

.empty { color: var(--muted); font-size: 13px; padding: 10px 0; }

.progress-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.progress-track {
  flex: 1;
  height: 8px;
  border-radius: 999px;
  background: #1b2130;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--green));
  transition: width 0.3s ease;
}
#progress-text { font-size: 12px; color: var(--muted); white-space: nowrap; }

.meta-row { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 10px; }

.log {
  background: #05070c;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 12px;
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.5;
  color: #c7cde0;
  max-height: 340px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.runs-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.runs-table th {
  text-align: left;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 8px 10px;
  border-bottom: 1px solid var(--panel-border);
}
.runs-table td { padding: 10px; border-bottom: 1px solid var(--panel-border); vertical-align: middle; }
.runs-table tr:last-child td { border-bottom: none; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.pill-running { background: rgba(91, 140, 255, 0.15); color: var(--accent); }
.pill-completed { background: rgba(53, 208, 143, 0.15); color: var(--green); }
.pill-empty { background: rgba(255, 182, 72, 0.15); color: var(--yellow); }
.pill-failed { background: rgba(255, 93, 108, 0.15); color: var(--red); }
.pill-error { background: rgba(255, 93, 108, 0.15); color: var(--red); }

.link-btn {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  padding: 0;
}

.hidden { display: none !important; }

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}
.modal-card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  width: min(760px, 92vw);
  max-height: 80vh;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.modal-head { display: flex; justify-content: space-between; align-items: center; }
.modal-head h3 { margin: 0; font-size: 15px; }
.modal .log { max-height: 60vh; }

@media (max-width: 980px) {
  .cards { grid-template-columns: repeat(2, 1fr); }
  .grid { grid-template-columns: 1fr; }
}
