/* PDF Converter — minimal, mobile-friendly */
:root {
  --bg: #ffffff;
  --fg: #1a1a1a;
  --muted: #6b7280;
  --line: #e5e7eb;
  --primary: #1F3864;
  --primary-hover: #2E75B6;
  --accent: #f4f6fa;
  --queued: #6b7280;
  --running: #b45309;
  --done: #047857;
  --failed: #b91c1c;
  --shadow: 0 1px 2px rgba(0,0,0,.05);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--fg);
  background: var(--bg);
}
.wrap { max-width: 880px; margin: 0 auto; padding: 0 16px; }

/* Header */
header {
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}
header .wrap {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 14px; padding-bottom: 14px;
}
header h1 { margin: 0; font-size: 18px; font-weight: 600; }
header h1 a { color: var(--fg); text-decoration: none; }
header nav a { color: var(--muted); font-size: 14px; }

/* Main */
main { padding-top: 24px; padding-bottom: 48px; }
section { margin-bottom: 32px; }
h2 { font-size: 18px; margin: 0 0 12px 0; }

/* Flash */
.flash {
  padding: 10px 14px; border-radius: 6px; margin-bottom: 16px;
  border: 1px solid;
}
.flash-ok { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
.flash-error { background: #fef2f2; border-color: #fecaca; color: #7f1d1d; }
.muted { color: var(--muted); }

/* Login */
.login-card {
  max-width: 340px; margin: 48px auto;
  border: 1px solid var(--line); border-radius: 10px;
  padding: 24px; background: var(--bg); box-shadow: var(--shadow);
}
.login-card h2 { margin-top: 0; }
.login-card label { display: block; font-weight: 500; margin-bottom: 6px; }
.login-card input[type="password"] {
  width: 100%; padding: 10px 12px; font-size: 16px;
  border: 1px solid var(--line); border-radius: 6px; margin-bottom: 14px;
}
.login-card button {
  width: 100%; padding: 10px 14px; font-size: 16px; font-weight: 500;
  background: var(--primary); color: white; border: 0; border-radius: 6px;
  cursor: pointer;
}
.login-card button:hover { background: var(--primary-hover); }

/* Upload */
.drop-zone {
  display: block;
  border: 2px dashed var(--line);
  border-radius: 10px;
  padding: 28px 18px;
  text-align: center;
  cursor: pointer;
  background: var(--accent);
  transition: border-color .15s, background-color .15s;
}
.drop-zone.dragging { border-color: var(--primary); background: #eef4fb; }
.drop-zone input[type="file"] { display: none; }
.drop-zone-text strong { display: block; font-size: 16px; margin-bottom: 4px; }
.drop-zone-text small { display: block; color: var(--muted); font-size: 13px; }

.options { display: flex; flex-wrap: wrap; gap: 16px; margin: 16px 0; }
.options fieldset {
  border: 1px solid var(--line); border-radius: 6px;
  padding: 8px 12px; margin: 0;
}
.options legend { color: var(--muted); font-size: 13px; padding: 0 4px; }
.options .radio, .options .checkbox {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer; user-select: none;
}
.options .checkbox { padding-top: 10px; }

button.primary {
  background: var(--primary); color: white; border: 0; border-radius: 6px;
  padding: 10px 18px; font-size: 16px; font-weight: 500; cursor: pointer;
}
button.primary:hover { background: var(--primary-hover); }
button.primary:disabled { background: var(--muted); cursor: progress; }

/* Upload progress */
#upload-progress { margin-top: 14px; }
.progress-row {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 6px; font-size: 14px; color: var(--muted);
}
#upload-pct { font-variant-numeric: tabular-nums; font-weight: 500; color: var(--fg); }
.progress-bar {
  width: 100%; height: 10px;
  background: var(--accent);
  border-radius: 999px; overflow: hidden;
}
.progress-bar-fill {
  width: 0%; height: 100%;
  background: var(--primary);
  transition: width 120ms linear;
}

/* Jobs */
.jobs-header { display: flex; align-items: center; justify-content: space-between; }
.jobs-actions { display: flex; gap: 8px; }

.job {
  border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px;
  margin-bottom: 10px; background: var(--bg);
}
.job header {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 8px;
  border: 0; padding: 0; background: transparent;
}
.job-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.job-title small { color: var(--muted); }
.job-actions { display: flex; gap: 6px; }
.log {
  margin: 8px 0 0 0; padding: 8px 10px; background: #f6f8fa;
  border-radius: 4px; font-size: 12px; line-height: 1.45;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap; word-break: break-word; color: #374151;
  max-height: 240px; overflow-y: auto;
}

.badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: 12px; font-weight: 500; color: white; text-transform: uppercase;
  letter-spacing: 0.04em;
}
.badge-queued { background: var(--queued); }
.badge-running { background: var(--running); }
.badge-done { background: var(--done); }
.badge-failed { background: var(--failed); }

.button-small {
  display: inline-block; padding: 4px 10px; font-size: 13px;
  background: var(--primary); color: white; text-decoration: none;
  border: 0; border-radius: 4px; cursor: pointer; font-family: inherit;
}
.button-small:hover { background: var(--primary-hover); }
.button-ghost { background: transparent; color: var(--muted); }
.button-ghost:hover { background: #f3f4f6; color: var(--fg); }

/* Backends panel */
.backends { margin-top: 24px; }
.backends summary { color: var(--muted); cursor: pointer; font-size: 14px; }
.backends ul { padding-left: 18px; }
.backends code { background: var(--accent); padding: 0 4px; border-radius: 3px; font-size: 13px; }

/* Footer */
footer { margin: 32px 0 16px; color: var(--muted); text-align: center; }

/* Mobile tweaks */
@media (max-width: 600px) {
  header h1 { font-size: 16px; }
  .drop-zone { padding: 22px 14px; }
  .options { gap: 12px; }
  .job header { flex-direction: column; align-items: flex-start; }
}
