:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --ink: #171a1f;
  --muted: #667085;
  --line: #d8dee8;
  --accent: #0f8f7c;
  --accent-dark: #087465;
  --blue: #3563e9;
  --warn: #b7791f;
  --error: #c24132;
  --shadow: 0 18px 45px rgba(32, 44, 68, 0.12);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 24px;
  width: min(1120px, calc(100vw - 32px));
  min-height: calc(100vh - 48px);
  margin: 24px auto;
  align-items: stretch;
}

.tool-panel,
.side-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.tool-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 620px;
  padding: 44px;
  border-radius: 8px;
}

.side-panel {
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 28px;
  border-radius: 8px;
}

.topbar,
.job-head,
.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.section-title {
  justify-content: flex-start;
  margin-bottom: 12px;
}

.section-title svg {
  width: 20px;
  color: var(--accent);
}

.kicker {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(34px, 7vw, 68px);
  line-height: 1;
}

h2 {
  font-size: 18px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  white-space: nowrap;
}

.status-pill.ready {
  border-color: rgba(15, 143, 124, 0.3);
  color: var(--accent-dark);
  background: rgba(15, 143, 124, 0.08);
}

.status-pill.error {
  border-color: rgba(194, 65, 50, 0.35);
  color: var(--error);
  background: rgba(194, 65, 50, 0.07);
}

.download-form {
  display: grid;
  gap: 22px;
  margin-top: 46px;
}

.field {
  display: grid;
  gap: 9px;
}

.field > span,
legend {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.input-row {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 60px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.input-row:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(15, 143, 124, 0.12);
}

.input-row svg {
  color: var(--accent);
}

input,
select {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}

input {
  height: 58px;
  font-size: 18px;
}

select {
  height: 46px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.control-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px;
  gap: 16px;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 0;
  padding: 0;
  border: 0;
}

.segmented legend {
  grid-column: 1 / -1;
  margin-bottom: 1px;
}

.segmented label {
  cursor: pointer;
}

.segmented input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented span {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #fbfcfe;
}

.segmented input:checked + span {
  border-color: rgba(53, 99, 233, 0.35);
  color: var(--blue);
  background: rgba(53, 99, 233, 0.08);
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 58px;
  border: 0;
  border-radius: 8px;
  color: #fff;
  background: var(--accent);
  font-weight: 800;
  cursor: pointer;
}

.primary-button:hover {
  background: var(--accent-dark);
}

.primary-button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.active-job {
  margin-top: 34px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}

#jobPercent {
  color: var(--accent-dark);
  font-weight: 900;
  font-size: 24px;
}

.progress-track {
  width: 100%;
  height: 12px;
  margin: 18px 0 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7ebf1;
}

#progressBar {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--blue));
  transition: width 180ms ease;
}

.job-meta {
  display: flex;
  gap: 18px;
  min-height: 22px;
  color: var(--muted);
  font-size: 14px;
}

.message,
.path-text,
footer {
  color: var(--muted);
  line-height: 1.55;
}

.path-text {
  word-break: break-all;
  margin: 0;
  padding: 12px;
  border-radius: 8px;
  background: #f3f5f8;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
}

.job-list {
  display: grid;
  gap: 10px;
}

.job-item {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.job-item strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}

.job-item span {
  color: var(--muted);
  font-size: 12px;
}

.job-item.done span {
  color: var(--accent-dark);
}

.job-item.error span {
  color: var(--error);
}

footer {
  margin-top: auto;
  font-size: 12px;
}

@media (max-width: 860px