:root {
  --bg: #f7f7f5;
  --surface: #ffffff;
  --text: #1d1d1b;
  --muted: #6b6b66;
  --border: #deded8;
  --accent: #2f5bd3;
  --accent-text: #ffffff;
  --danger: #b42318;
  --error-bg: #fdecea;
  --info-bg: #e9effc;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161615;
    --surface: #20201e;
    --text: #ececea;
    --muted: #9b9b95;
    --border: #3a3a37;
    --accent: #7c9cf0;
    --accent-text: #10131c;
    --danger: #f2827a;
    --error-bg: #3b1d1a;
    --info-bg: #1c2438;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
}
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
header .brand { font-weight: 600; color: var(--text); text-decoration: none; }
nav { display: flex; align-items: center; gap: 1rem; }
nav form { margin: 0; }
main { max-width: 52rem; margin: 0 auto; padding: 1.5rem 1rem 4rem; }
h1 { font-size: 1.4rem; margin: 0 0 1rem; overflow-wrap: anywhere; }
h2 { font-size: 1.15rem; margin: 2rem 0 0.75rem; }
a { color: var(--accent); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}
.card.narrow { max-width: 26rem; }
.card h1, .card h2 { margin-top: 0; }

label { display: block; margin-bottom: 0.75rem; font-weight: 500; }
label.checkbox { display: flex; gap: 0.5rem; align-items: center; font-weight: normal; }
input:not([type=checkbox]), select {
  display: block;
  width: 100%;
  margin-top: 0.25rem;
  padding: 0.5rem;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
}
.row { display: flex; gap: 1rem; flex-wrap: wrap; }
.row > label { flex: 1 1 12rem; }

button, .button {
  display: inline-block;
  padding: 0.5rem 1rem;
  font: inherit;
  font-weight: 500;
  color: var(--accent-text);
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
}
button:disabled { opacity: 0.6; cursor: wait; }
.button { color: var(--accent); background: transparent; }
button.danger { color: var(--danger); background: transparent; border-color: var(--danger); }
button.link { padding: 0; color: var(--accent); background: none; border: none; font-weight: normal; }

.hint, .meta { color: var(--muted); font-size: 0.9rem; }
.flash { padding: 0.6rem 0.8rem; border-radius: 6px; background: var(--info-bg); }
.flash.error { background: var(--error-bg); color: var(--danger); }
progress { width: 100%; height: 0.6rem; accent-color: var(--accent); }
#upload-progress { margin-top: 1rem; }

table { width: 100%; border-collapse: collapse; font-size: 0.95rem; margin-bottom: 1.5rem; }
th, td { text-align: left; padding: 0.5rem 0.4rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-weight: 500; }
td:first-child { overflow-wrap: anywhere; }
tr.archived, tr.archived a { color: var(--muted); }
tr.failed td:nth-child(4) { color: var(--danger); }
.row-actions { display: flex; gap: 0.5rem; align-items: flex-start; flex-wrap: wrap; justify-content: flex-end; }
.row-actions form { margin: 0; display: flex; gap: 0.5rem; }
.row-actions input { margin: 0; width: 12rem; }
summary { cursor: pointer; color: var(--accent); }

.actions { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.5rem; }
.transcript { margin: 1.5rem 0; }
.transcript section { display: flex; gap: 1rem; }
.transcript .time { flex: none; width: 4.5rem; padding-top: 0.15rem; color: var(--muted); font-size: 0.85rem; font-variant-numeric: tabular-nums; }
.transcript p { margin: 0 0 1rem; }

@media (max-width: 40rem) {
  table.jobs th:nth-child(3), table.jobs td:nth-child(3),
  table.jobs th:nth-child(5), table.jobs td:nth-child(5) { display: none; }
  .transcript section { flex-direction: column; gap: 0; }
}
