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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: #1c1917;
  background: #f5f3ef;
  min-height: 100vh;
  padding: 3rem 1rem;
}

.container {
  max-width: 600px;
  margin: 0 auto;
}

h1 {
  font-size: 1.375rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 0.3rem;
}

.subtitle {
  color: #78716c;
  margin-bottom: 2rem;
}

/* ── Card ── */
.card {
  background: #fff;
  border: 1px solid #e5e2dc;
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 12px rgba(0,0,0,.05);
  padding: 1.75rem;
}

/* ── Notices ── */
.notice {
  border-radius: 8px;
  padding: 0.875rem 1rem;
  font-size: 0.875rem;
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

.notice-warn {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-left: 3px solid #d97706;
  color: #78350f;
}

.notice-warn > strong {
  display: block;
  color: #92400e;
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.notice-success {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-left: 3px solid #16a34a;
  color: #14532d;
}

.notice-error {
  background: #fff1f2;
  border: 1px solid #fecdd3;
  border-left: 3px solid #e11d48;
  color: #881337;
}

.notice ul { padding-left: 1.25rem; }
.notice li + li { margin-top: 0.3rem; }

/* ── Form ── */
.field-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: #374151;
  margin-bottom: 0.4rem;
}

.file-input {
  display: block;
  width: 100%;
  padding: 0.5rem 0.75rem;
  font-family: inherit;
  font-size: 0.9375rem;
  color: #374151;
  background: #fafaf9;
  border: 1px solid #d6d3cd;
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.file-input:focus {
  outline: none;
  border-color: #166534;
  box-shadow: 0 0 0 3px rgba(22,101,52,.12);
}

/* ── Button ── */
.btn {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 1.125rem;
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 500;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  margin-top: 1.125rem;
  transition: background 0.15s, transform 0.1s, opacity 0.15s;
}

.btn-primary { background: #166534; color: #fff; }
.btn-primary:hover:not(:disabled) { background: #14532d; }
.btn-primary:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: default; }

/* ── Spinner ── */
.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid #d1d5db;
  border-top-color: #166534;
  border-radius: 50%;
  flex-shrink: 0;
  animation: spin 0.75s linear infinite;
}

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

/* ── Progress ── */
.progress-section {
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid #f0ede8;
}

.status-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #374151;
  font-size: 0.9rem;
  margin-bottom: 0.625rem;
}

.elapsed { color: #9ca3af; font-size: 0.8125rem; }

.progress-track {
  height: 4px;
  background: #e5e2dc;
  border-radius: 99px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: #166534;
  border-radius: 99px;
  transition: width 0.2s ease;
}

/* ── Batch list (batches page) ── */
.batch-list {
  list-style: none;
  border: 1px solid #e5e2dc;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 1.5rem;
}

.batch-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.7rem 1rem;
  font-size: 0.875rem;
  border-bottom: 1px solid #f0ede8;
}

.batch-item:last-child { border-bottom: none; }
.batch-item:nth-child(even) { background: #fafaf9; }

.batch-name { color: #374151; font-family: ui-monospace, 'SFMono-Regular', Consolas, monospace; }

.batch-status { font-size: 0.8rem; font-weight: 500; }
.batch-status[data-state="waiting"]  { color: #9ca3af; }
.batch-status[data-state="active"]   { color: #2563eb; }
.batch-status[data-state="done"]     { color: #16a34a; }
.batch-status[data-state="failed"]   { color: #dc2626; }

/* ── Overall progress header (batches page) ── */
.progress-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.875rem;
  margin-bottom: 0.4rem;
}

.progress-header #overall-status { color: #374151; }
.progress-header #batch-counter { color: #9ca3af; }

/* ── Misc ── */
code {
  background: #f3f2ef;
  padding: .1em .35em;
  border-radius: 4px;
  font-size: 0.85em;
  font-family: ui-monospace, 'SFMono-Regular', Consolas, monospace;
}

a { color: #166534; font-weight: 500; text-decoration: none; }
a:hover { color: #14532d; text-decoration: underline; }
