/* ---------- Design tokens ---------- */
:root {
  --ink: #18181b;
  --ink-soft: #52525b;
  --ink-faint: #a1a1aa;
  --paper: #fafafa;
  --surface: #ffffff;
  --border: rgba(24, 24, 27, 0.08);
  --border-strong: rgba(24, 24, 27, 0.14);
  --accent: #c23e7d;
  --accent-ink: #8a2a5c;
  --accent-soft: #f8e4ee;
  --accent-a30: rgba(194, 62, 125, 0.28);
  --good: #16794f;
  --good-soft: #e2f5ec;
  --bad: #b8402e;
  --bad-soft: #fbe6e2;
  --warn: #a86a12;
  --warn-soft: #f8ecd6;
  --muted-soft: #eeeef0;
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(24, 24, 27, 0.05);
  --shadow-md: 0 12px 32px -16px rgba(24, 24, 27, 0.22);
}
@media (prefers-color-scheme: dark) {
  :root {
    --ink: #f4f4f5;
    --ink-soft: #a1a1aa;
    --ink-faint: #71717a;
    --paper: #0d0d0f;
    --surface: #19191c;
    --border: rgba(244, 244, 245, 0.08);
    --border-strong: rgba(244, 244, 245, 0.15);
    --accent: #f088bc;
    --accent-ink: #f7b8d9;
    --accent-soft: rgba(240, 136, 188, 0.14);
    --accent-a30: rgba(240, 136, 188, 0.32);
    --good: #6fda9c;
    --good-soft: rgba(111, 218, 156, 0.14);
    --bad: #e8897a;
    --bad-soft: rgba(232, 137, 122, 0.14);
    --warn: #e3b463;
    --warn-soft: rgba(227, 180, 99, 0.14);
    --muted-soft: rgba(244, 244, 245, 0.06);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 16px 36px -16px rgba(0, 0, 0, 0.6);
  }
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
.wrap { max-width: 720px; margin: 0 auto; padding: 48px 24px 96px; }

/* ---------- Header ---------- */
.topbar { display: flex; align-items: center; margin-bottom: 40px; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 1.05rem; font-weight: 700; letter-spacing: -0.01em; }
.brand-mark { width: 9px; height: 9px; border-radius: 3px; background: var(--accent); flex-shrink: 0; }

/* ---------- Section headings ---------- */
h1, h2, h3 { margin: 0; }
.section-title {
  font-size: 0.74rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ink-faint); margin: 0 0 14px;
}
section + section { margin-top: 40px; }

/* ---------- Card ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 28px; box-shadow: var(--shadow-sm);
}

/* ---------- Form ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field span { font-size: 0.84rem; font-weight: 600; color: var(--ink-soft); }
.field span .optional { font-weight: 400; color: var(--ink-faint); }
.field input[type="url"], .field input[type="text"] {
  padding: 11px 14px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--paper); color: var(--ink); font-size: 0.94rem; font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.field input[type="url"]:focus, .field input[type="text"]:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-a30);
}
.field input[type="url"]::placeholder, .field input[type="text"]::placeholder { color: var(--ink-faint); }

.divider { display: flex; align-items: center; gap: 12px; margin: 18px 0; color: var(--ink-faint); font-size: 0.78rem; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border-strong); }

/* Drag-and-drop dropzone */
.dropzone {
  border: 1.5px dashed var(--border-strong); border-radius: var(--radius-md);
  padding: 28px 20px; text-align: center; cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.dropzone:hover { border-color: var(--ink-faint); }
.dropzone.dragover { border-color: var(--accent); background: var(--accent-soft); }
.dropzone.has-file { border-style: solid; border-color: var(--good); background: var(--good-soft); }
.dropzone-icon { font-size: 1.4rem; margin-bottom: 6px; opacity: 0.6; }
.dropzone-text { margin: 0; font-size: 0.9rem; color: var(--ink-soft); }
.dropzone-text strong { color: var(--ink); }
.dropzone-filename { margin: 6px 0 0; font-size: 0.84rem; font-weight: 600; color: var(--good); }

button[type="submit"] {
  width: 100%; margin-top: 20px; background: var(--ink); color: var(--surface); border: none;
  border-radius: var(--radius-sm); padding: 12px 20px; font-size: 0.94rem; font-weight: 600;
  font-family: inherit; cursor: pointer; transition: opacity 0.15s ease, transform 0.1s ease;
}
button[type="submit"]:hover { opacity: 0.88; }
button[type="submit"]:active { transform: scale(0.99); }
button[type="submit"]:disabled { opacity: 0.5; cursor: default; transform: none; }
.error { color: var(--bad); font-size: 0.85rem; margin: 12px 0 0; }

/* ---------- Job list ---------- */
.job-list { display: flex; flex-direction: column; gap: 1px; background: var(--border); border-radius: var(--radius-md); overflow: hidden; }
.job-row {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  background: var(--surface); padding: 14px 16px;
}
.job-info { min-width: 0; }
.job-title {
  margin: 0; font-size: 0.92rem; font-weight: 600; color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 360px;
}
.job-meta { margin: 3px 0 0; font-size: 0.78rem; color: var(--ink-faint); }
.job-side { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.job-link { color: var(--accent-ink); font-weight: 600; font-size: 0.84rem; text-decoration: none; white-space: nowrap; }
.job-link:hover { text-decoration: underline; }
.job-note { font-size: 0.8rem; max-width: 220px; text-align: right; }
.muted { color: var(--ink-faint); }
.error-text { color: var(--bad); }

/* Status pills */
.pill {
  display: inline-flex; align-items: center; gap: 6px; font-size: 0.76rem; font-weight: 600;
  padding: 4px 11px; border-radius: 999px; white-space: nowrap;
}
.pill-queued, .pill-processing { background: var(--warn-soft); color: var(--warn); }
.pill-done { background: var(--good-soft); color: var(--good); }
.pill-failed { background: var(--bad-soft); color: var(--bad); }
.pill-skipped_not_ad { background: var(--muted-soft); color: var(--ink-soft); }
.pill-processing::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor;
  animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 0.35; } 50% { opacity: 1; } }

.empty-state { margin: 0; padding: 32px 16px; text-align: center; color: var(--ink-faint); font-size: 0.88rem; background: var(--surface); }

@media (max-width: 560px) {
  .wrap { padding: 32px 16px 72px; }
  .topbar { flex-direction: column; align-items: flex-start; gap: 12px; }
  .job-row { flex-direction: column; align-items: flex-start; gap: 8px; }
  .job-title { max-width: 100%; }
  .job-side { width: 100%; justify-content: space-between; }
}
