:root {
  color-scheme: light;
  color: #202521;
  background: #f4f6f3;
  font: 16px/1.5 system-ui, sans-serif;
  --ink: #202521;
  --muted: #555e56;
  --line: #dce3dc;
  --card: #fff;
  --accent: #24674c;
  --accent-dark: #18523b;
  --error: #8a2b26;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(1.65rem, 1.35rem + 1.3vw, 2.3rem); line-height: 1.2; letter-spacing: -.025em; }
h2 { font-size: 1.2rem; line-height: 1.3; }
a { color: var(--accent-dark); text-underline-offset: .15em; }
button, input, textarea { font: inherit; }
:focus-visible { outline: 3px solid #3c8c69; outline-offset: 3px; }

.shell { width: min(100% - 2rem, 54rem); margin-inline: auto; }
.topbar { background: var(--card); border-bottom: 1px solid var(--line); }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 4.25rem; }
.brand { display: inline-flex; align-items: center; gap: .65rem; color: var(--ink); font-weight: 750; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 1.9rem; height: 1.9rem; border-radius: .5rem; background: var(--accent); color: #fff; }
.workspace { display: grid; gap: 1.5rem; padding-block: clamp(1.5rem, 4vw, 3rem); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: .9rem; }
.queue-card, .empty-history { padding: clamp(1rem, 2.5vw, 1.5rem); }
.queue-card h2 { margin-bottom: 1rem; }
.queue-form, .login-form, .field { display: grid; gap: .6rem; }
.queue-form, .login-form { gap: 1rem; }
.queue-form .button { justify-self: start; }
.field { gap: .4rem; }
.field label { font-size: .94rem; font-weight: 650; }
.field input, .field textarea { width: 100%; border: 1px solid #aeb8ae; border-radius: .55rem; padding: .6rem .75rem; color: var(--ink); background: var(--card); }
.field textarea { resize: vertical; min-height: 5.5rem; }
.field input::placeholder, .field textarea::placeholder { color: #627063; }
.hint, .intro { color: var(--muted); font-size: .9rem; }
.button { display: inline-block; min-height: 2.65rem; border: 1px solid transparent; border-radius: .55rem; padding: .55rem 1rem; background: var(--accent); color: #fff; cursor: pointer; font-weight: 680; text-align: center; }
.button:hover { background: var(--accent-dark); }
.button-secondary { background: transparent; border-color: #b9c6bc; color: var(--accent-dark); }
.button-secondary:hover { background: #eef4ef; }
.button-danger { background: var(--error); }
.button-danger:hover { background: #6f201c; }
.message { padding: .7rem .85rem; border: 1px solid #b9d6c4; border-radius: .55rem; background: #ecf7ef; overflow-wrap: anywhere; }
.message-error { border-color: #e3c3c0; background: #fcf0ef; color: var(--error); }

.history { display: grid; gap: .8rem; }
.empty-history { color: var(--muted); }
.job-list { display: grid; gap: .65rem; margin: 0; padding: 0; list-style: none; }
.job { display: grid; gap: .55rem; padding: .9rem 1rem; }
.job-summary { display: flex; align-items: flex-start; justify-content: space-between; gap: .75rem; }
.job-source { min-width: 0; overflow-wrap: anywhere; }
.job-url { color: var(--muted); font-size: .86rem; }
.badge { flex: 0 0 auto; border-radius: 1rem; padding: .15rem .6rem; background: #edf0ec; color: #485348; font-size: .79rem; font-weight: 650; }
.badge-downloading { background: #e8f1fb; color: #264d79; }
.badge-completed { background: #e8f5ec; color: var(--accent-dark); }
.badge-error { background: #fae9e7; color: var(--error); }
.job-error { color: var(--error); font-size: .88rem; overflow-wrap: anywhere; }
.job-progress { display: flex; align-items: center; gap: .7rem; color: var(--muted); font-size: .86rem; }
.job-progress progress { width: min(22rem, 75%); accent-color: var(--accent); }
.download-link { justify-self: start; font-weight: 650; }
.file-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1rem; }
.file-actions form { margin: 0; }

.login-page { display: grid; place-items: center; min-height: 100vh; padding: 1rem; }
.login-card { display: grid; gap: .8rem; width: min(100%, 25rem); padding: clamp(1rem, 5vw, 1.8rem); }
.login-card .brand { margin-bottom: .35rem; }
.login-form { margin-top: .45rem; }
.captcha-row { display: flex; align-items: center; flex-wrap: wrap; gap: .4rem .7rem; }
.captcha-row img { display: block; max-width: 100%; height: auto; border: 1px solid var(--line); border-radius: .45rem; }
.captcha-row a { font-size: .87rem; }

@media (max-width: 29rem) {
  .job-summary { flex-wrap: wrap; }
  .queue-form .button { justify-self: stretch; }
}
