:root {
  --bg: #111114;
  --surface: #1a1a1f;
  --surface-2: #22222a;
  --border: #2d2d36;
  --text: #f2f2f5;
  --text-dim: #9b9ba6;
  --accent: #5b8cff;
  --accent-dim: #3a4b8a;
  --success: #4ade80;
  --danger: #f87171;
  --warning: #fbbf24;
  --radius-lg: 20px;
  --radius-pill: 999px;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, "Segoe UI", Roboto, Inter, Helvetica, Arial, sans-serif;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  cursor: pointer;
}

/* ---------- login ---------- */

.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  width: min(360px, 90vw);
  padding: 40px 32px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  text-align: center;
}

.login-card .brand {
  font-size: 1.6rem;
  font-weight: 700;
  margin: 0;
}

.login-card .subtitle {
  color: var(--text-dim);
  margin: 8px 0 24px;
  font-size: 0.9rem;
}

#login-form {
  display: flex;
  gap: 8px;
}

#login-form input {
  flex: 1;
}

.error {
  color: var(--danger);
  font-size: 0.85rem;
  margin-top: 16px;
}

/* ---------- shared controls ---------- */

input[type="text"],
input[type="password"],
input[type="url"],
select {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-pill);
  padding: 12px 18px;
  font-size: 0.95rem;
  outline: none;
}

input::placeholder {
  color: var(--text-dim);
}

input:focus,
select:focus {
  border-color: var(--accent);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: transparent;
  border: none;
  color: var(--text-dim);
  transition: background 0.15s, color 0.15s;
}

.icon-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}

.go-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--accent);
  color: #0c0c0e;
  border: none;
  flex-shrink: 0;
}

.go-btn:hover {
  background: #74a0ff;
}

/* ---------- layout ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 28px;
}

.brand {
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 0.01em;
}

main {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 20px 80px;
}

.hero {
  text-align: center;
  padding: 48px 12px 32px;
}

.hero h1 {
  font-size: 2rem;
  font-weight: 700;
  margin: 0 0 8px;
}

.hero .tagline {
  color: var(--text-dim);
  margin: 0 0 32px;
  font-size: 0.95rem;
}

.input-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 6px 6px 6px 20px;
  max-width: 560px;
  margin: 0 auto;
}

.input-pill input {
  flex: 1;
  background: transparent;
  border: none;
  padding: 10px 0;
}

.options-panel {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-top: 18px;
  flex-wrap: wrap;
}

.options-panel label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--text-dim);
  text-align: left;
}

.options-panel .checkbox-label {
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 8px;
  align-self: center;
}

.options-panel .checkbox-label input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

/* ---------- job list ---------- */

.jobs {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 16px;
}

.job-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
}

.job-main {
  flex: 1;
  min-width: 0;
}

.job-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.job-title {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.job-url {
  color: var(--text-dim);
  font-size: 0.8rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.job-status-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.job-badge {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  color: var(--text-dim);
}

.job-badge[data-status="downloading"],
.job-badge[data-status="retrying"],
.job-badge[data-status="converting"] {
  background: rgba(91, 140, 255, 0.15);
  color: var(--accent);
}

.job-badge[data-status="ready"],
.job-badge[data-status="downloaded"] {
  background: rgba(74, 222, 128, 0.15);
  color: var(--success);
}

.job-badge[data-status="failed"] {
  background: rgba(248, 113, 113, 0.15);
  color: var(--danger);
}

.job-badge[data-status="expired"] {
  background: rgba(251, 191, 36, 0.15);
  color: var(--warning);
}

.job-meta {
  font-size: 0.78rem;
  color: var(--text-dim);
}

progress.job-progress {
  width: 100%;
  height: 6px;
  margin-top: 10px;
  border-radius: var(--radius-pill);
  overflow: hidden;
  border: none;
  background: var(--surface-2);
}

progress.job-progress::-webkit-progress-bar {
  background: var(--surface-2);
  border-radius: var(--radius-pill);
}

progress.job-progress::-webkit-progress-value {
  background: var(--accent);
  border-radius: var(--radius-pill);
}

progress.job-progress::-moz-progress-bar {
  background: var(--accent);
  border-radius: var(--radius-pill);
}

.job-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.convert-row {
  display: flex;
  align-items: center;
  gap: 4px;
}

.convert-row select {
  padding: 8px 12px;
  font-size: 0.8rem;
}

.empty-state {
  text-align: center;
  color: var(--text-dim);
  font-size: 0.9rem;
  padding: 32px 0;
}

@media (max-width: 520px) {
  .job-card {
    flex-wrap: wrap;
  }
}
