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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: #f5f5f5;
  color: #222;
  line-height: 1.5;
}

.container {
  max-width: 1100px;
  margin: 2rem auto;
  padding: 0 1rem;
}

h1 { font-size: 1.6rem; margin-bottom: 0.25rem; }
.subtitle { color: #666; margin-bottom: 1.5rem; }

.upload-area {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 1.25rem;
  background: #fff;
  border: 2px dashed #ccc;
  border-radius: 8px;
  margin-bottom: 1rem;
}

.upload-area.dragover {
  border-color: #2563eb;
  background: #eff6ff;
}

.drop-prompt { color: #888; font-size: 0.9rem; }

.upload-area input[type="file"] { flex: 0 0 auto; }
.filename { color: #666; font-size: 0.9rem; }

button {
  padding: 0.5rem 1.1rem;
  border: none;
  border-radius: 5px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

#upload-btn {
  background: #2563eb;
  color: #fff;
}
#upload-btn:hover:not(:disabled) { background: #1d4ed8; }
#upload-btn:disabled { background: #94a3b8; cursor: not-allowed; }

#download-all-btn {
  background: #16a34a;
  color: #fff;
}
#download-all-btn:hover { background: #15803d; }

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.results-header h2 { font-size: 1.2rem; }
#run-count { font-weight: normal; color: #666; font-size: 0.95rem; }

.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

th, td {
  padding: 0.55rem 0.75rem;
  text-align: left;
  white-space: nowrap;
}

th {
  background: #f8fafc;
  border-bottom: 2px solid #e2e8f0;
  font-weight: 600;
  font-size: 0.85rem;
  color: #475569;
}

tbody tr:nth-child(even) { background: #f8fafc; }
tbody tr:hover { background: #eef2ff; }

td:last-child { text-align: center; }

.btn-csv {
  background: #2563eb;
  color: #fff;
  width: 2rem;
  height: 2rem;
  font-size: 1.1rem;
  border-radius: 5px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-csv:hover { background: #1d4ed8; }

.badge-ok {
  background: #dcfce7;
  color: #166534;
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  font-size: 0.8rem;
}

.badge-warn {
  background: #fef3c7;
  color: #92400e;
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  font-size: 0.8rem;
}

.hidden { display: none !important; }

.loading {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem;
  color: #555;
}

.progress-info {
  flex: 1;
  max-width: 400px;
}

.progress-info span {
  display: block;
  font-size: 0.9rem;
  margin-bottom: 0.3rem;
}

.progress-stage {
  color: #64748b;
  font-size: 0.82rem;
}

.progress-bar {
  height: 6px;
  background: #e2e8f0;
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: #2563eb;
  border-radius: 3px;
  transition: width 0.15s ease;
}

.progress-fill.indeterminate {
  width: 30%;
  animation: indeterminate 1.2s ease-in-out infinite;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 3px solid #e2e8f0;
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

@keyframes indeterminate {
  0% { margin-left: 0; }
  50% { margin-left: 70%; }
  100% { margin-left: 0; }
}

.error {
  padding: 0.75rem 1rem;
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
  border-radius: 6px;
  margin-bottom: 1rem;
}
