:root {
  --green: #1b8a4a;
  --green-dark: #146238;
  --red: #d33232;
  --red-dark: #a91f1f;
  --blue: #3b5bdb;
  --blue-dark: #2f47ad;
  --indigo: #4f46e5;
  --indigo-dark: #4338ca;
  --skyblue: #e6f4ff;
  --bg: #f1f3f9;
  --panel-bg: #ffffff;
  --border: #e2e5ee;
  --text: #1c2130;
  --muted: #6b7182;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 1px 3px rgba(16, 24, 40, 0.06);
  --shadow-lg: 0 4px 10px rgba(16, 24, 40, 0.08), 0 2px 4px rgba(16, 24, 40, 0.06);
  --radius: 12px;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: "Segoe UI", "Inter", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

/* ---------- Header ---------- */
.title-bar {
  background: linear-gradient(120deg, var(--indigo) 0%, var(--blue) 55%, #2563eb 100%);
  color: #fff;
  box-shadow: var(--shadow-lg);
  position: sticky;
  top: 0;
  z-index: 20;
}

.title-bar-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  row-gap: 8px;
}

.title-bar h1 {
  margin: 0;
  font-size: 19px;
  font-weight: 600;
  flex: 1;
  min-width: 0;
  letter-spacing: 0.2px;
}

.header-running {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  background: var(--green);
  border: 1px solid var(--green-dark);
  color: #ffffff;
  font-weight: 700;
  font-size: 13px;
  padding: 6px 14px;
  border-radius: 999px;
  animation: pulseBannerGreen 1.4s ease-in-out infinite;
}

.header-running .running-dot { background: #d9fce0; }

.version-tag {
  font-size: 12px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.18);
  padding: 2px 8px;
  border-radius: 999px;
  vertical-align: middle;
  margin-left: 4px;
}

.brand-logo {
  height: 40px;
  width: 40px;
  object-fit: contain;
  background: #fff;
  border-radius: 8px;
  padding: 3px;
  box-shadow: var(--shadow);
  flex-shrink: 0;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-about {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.35);
}

.btn-about:hover { background: rgba(255, 255, 255, 0.28); }

/* ---------- Layout ---------- */
.container {
  max-width: 1280px;
  margin: 24px auto;
  padding: 0 16px 60px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.panel {
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
}

.panel h2 {
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.file-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.file-row:last-child { margin-bottom: 0; }

.bold { font-weight: 600; }

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

.template-hint {
  display: flex;
  flex-direction: column;
  line-height: 1.3;
  color: var(--muted);
  font-size: 13px;
}

.btn-clear-file {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.btn-clear-file:hover { background: #fdecec; color: var(--red-dark); border-color: #f3b9b9; }

select, input[type="file"] {
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  font-size: 13px;
}

select:focus, input:focus { outline: 2px solid var(--indigo); outline-offset: 1px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: 9px;
  border: none;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  text-decoration: none;
  color: #fff;
  background: var(--blue);
  box-shadow: var(--shadow);
  transition: transform 0.06s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-lg); }
.btn:active { transform: translateY(0); }

.btn-secondary { background: #475069; }
.btn-secondary:hover { background: #384062; }
.btn-small { padding: 5px 12px; font-size: 12px; box-shadow: none; }
.btn-start { background: var(--green); font-size: 15px; padding: 11px 28px; }
.btn-start:hover { background: var(--green-dark); }
.btn-stop { background: var(--red); font-size: 15px; padding: 11px 28px; }
.btn-stop:hover { background: var(--red-dark); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; box-shadow: none; }

/* ---------- Checkbox grid ---------- */
.checkbox-columns {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px 28px;
}

.checkbox-col {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  padding: 7px 10px;
  border-radius: 8px;
  background: #eef1fb;
  border: 1px solid #e1e6f8;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.checkbox-item:hover { background: #dfe5fa; border-color: #c7d0f2; }
.checkbox-item:has(input:checked) { background: #dcecff; border-color: var(--indigo); }
.checkbox-item input { flex-shrink: 0; width: 15px; height: 15px; accent-color: var(--indigo); }
.checkbox-item.disabled { color: var(--muted); background: #f0f1f5; border-color: var(--border); }
.checkbox-item:has(input:disabled) { opacity: 0.55; }
.checkbox-item:has(input:disabled):hover { background: #eef1fb; border-color: #e1e6f8; }

.toggle-chip {
  background: var(--skyblue);
  color: #144a7c;
  padding: 8px 14px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 13px;
}

.toggle-chip input { accent-color: var(--blue); }
.toggle-chip:has(input:disabled) { opacity: 0.55; }

select:disabled { opacity: 0.55; cursor: not-allowed; }

.action-row {
  margin-top: 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

/* ---------- Counters ---------- */
.counters-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.counter {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 120px;
  flex: 1;
  padding: 12px 8px;
  border-radius: 10px;
  background: #f7f8fc;
  border: 1px solid var(--border);
}

.counter-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.4px; }
.counter-value { font-size: 24px; font-weight: 700; margin-top: 2px; }
.counter.pass { background: #eafaf0; }
.counter.pass .counter-value { color: var(--green); }
.counter.fail { background: #fdecec; }
.counter.fail .counter-value { color: var(--red); }

/* ---------- Running indicator (now shown in the header) ---------- */
.running-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #f5a300;
  flex-shrink: 0;
  animation: pulseDot 1.4s ease-in-out infinite;
}

@keyframes pulseBannerGreen {
  0%, 100% { box-shadow: var(--shadow); border-color: var(--green-dark); }
  50% { box-shadow: 0 0 0 4px rgba(27, 138, 74, 0.35); border-color: #0f4a2a; }
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.8); }
}

/* ---------- Status / downloads ---------- */
.status-panel { font-size: 14px; }

.status-row { margin-bottom: 12px; }

.status-pill {
  display: inline-block;
  padding: 3px 12px;
  border-radius: 999px;
  background: #eef0fa;
  font-weight: 700;
  text-transform: capitalize;
}

.downloads-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.downloads-row .hint { flex-basis: 100%; margin-bottom: 2px; }

.finished-summary {
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
  background: #f7f8fc;
  border-radius: 8px;
  padding: 14px 18px;
  text-align: left;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.panel-header h2 { margin: 0; }

.log-output {
  background: #0d1117;
  color: #7ee787;
  font-family: Consolas, "Cascadia Mono", monospace;
  font-size: 12px;
  padding: 12px;
  height: 280px;
  overflow-y: auto;
  white-space: pre-wrap;
  border-radius: 10px;
  border: 1px solid #21262d;
}

.table-scroll {
  overflow-x: auto;
  border-radius: 10px;
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th, td {
  border-bottom: 1px solid var(--border);
  padding: 8px 10px;
  text-align: left;
}

th {
  background: #2b2f6b;
  color: #fff;
  font-weight: 600;
  position: sticky;
  top: 0;
}

tbody tr:hover { background: #f7f8fc; }
tr.row-pass td:nth-child(5) { background: #d9f5e2; font-weight: 600; color: var(--green-dark); }
tr.row-fail td:nth-child(5) { background: #fbdada; font-weight: 600; color: var(--red-dark); }

/* ---------- Footer ---------- */
.app-footer {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  padding: 20px 0 40px;
}

/* ---------- About modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 18, 30, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.modal-box {
  background: #fff;
  border-radius: var(--radius);
  padding: 24px 28px;
  min-width: 300px;
  max-width: 90vw;
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.modal-box h2 { margin-top: 0; }

.about-text {
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
  color: var(--text);
  background: #f7f8fc;
  border-radius: 8px;
  padding: 14px 18px;
  margin: 14px 0;
  text-align: left;
}

@media (max-width: 700px) {
  .checkbox-columns { grid-template-columns: 1fr; }
  .title-bar h1 { font-size: 15px; }
  .brand-logo { height: 30px; width: 30px; }
}
