:root {
  --bg: #0f1419;
  --card: #1a2332;
  --border: #2d3a4f;
  --text: #e8edf4;
  --muted: #8b9cb3;
  --accent: #4f8cff;
  --accent-hover: #3a7aef;
  --error: #e85d5d;
  --radius: 10px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--card);
}

.topbar h1 {
  margin: 0;
  font-size: 1.25rem;
}

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 1.5rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
}

.login-card {
  width: 100%;
  max-width: 380px;
}

.instructions {
  color: var(--muted);
  margin-top: 0;
}

label {
  display: block;
  margin: 1rem 0 0.35rem;
  font-size: 0.9rem;
  font-weight: 500;
}

input[type="url"],
input[type="text"],
input[type="password"],
textarea {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
}

textarea {
  resize: vertical;
  min-height: 120px;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  border-radius: 6px;
  font-size: 0.95rem;
}

.btn-primary {
  margin-top: 1.25rem;
  padding: 0.7rem 1.25rem;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}

.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary {
  padding: 0.45rem 0.9rem;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}

.logout-form { margin: 0; }

.prompt-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 1rem;
}

.prompt-header label { margin: 0; }

.btn-link {
  background: none;
  color: var(--accent);
  padding: 0;
  font-size: 0.85rem;
}

.progress-bar {
  height: 8px;
  background: var(--bg);
  border-radius: 4px;
  overflow: hidden;
  margin: 0.75rem 0;
}

#progress_fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.3s ease;
}

.downloads {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.downloads a {
  display: inline-block;
  padding: 0.6rem 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--accent);
  text-decoration: none;
}

.downloads a:hover { border-color: var(--accent); }

.preview {
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 400px;
  overflow: auto;
  font-size: 0.85rem;
  background: var(--bg);
  padding: 1rem;
  border-radius: 6px;
}

.hidden { display: none !important; }

.error-card { border-color: var(--error); }
.error-card h2 { color: var(--error); }

.muted { color: var(--muted); font-size: 0.9rem; }

.job-id { font-size: 0.8rem; font-family: monospace; }

.preview-details summary {
  cursor: pointer;
  color: var(--muted);
  margin-bottom: 0.5rem;
}
