:root {
  --bg: #0f1115;
  --surface: #171a21;
  --surface-2: #1f232c;
  --line: #2a2f3a;
  --text: #e8eaf0;
  --muted: #949cad;
  --accent: #e5484d;
  --accent-soft: #3a1c20;
  --ok: #3dd68c;
  --warn: #f5a524;
  --radius: 12px;
  --gap: 16px;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f5f6f8;
    --surface: #ffffff;
    --surface-2: #f0f2f5;
    --line: #dfe3ea;
    --text: #12141a;
    --muted: #616b7d;
    --accent-soft: #fdecec;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap);
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  font-weight: 600;
  text-decoration: none;
}

.brand-mark {
  width: 26px;
  height: 18px;
  border-radius: 5px;
  background: var(--accent);
  position: relative;
}

.brand-mark::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 0;
  height: 0;
  border-left: 7px solid #fff;
  border-top: 4.5px solid transparent;
  border-bottom: 4.5px solid transparent;
}

.topbar-right { display: flex; align-items: center; gap: 12px; }
.who { color: var(--muted); font-size: 13px; }

.wrap {
  max-width: 880px;
  margin: 0 auto;
  padding: 24px 16px 64px;
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}

.card.login { text-align: center; max-width: 420px; margin: 10vh auto 0; }
.card.login h1 { font-size: 22px; margin: 0 0 8px; }

h2 { font-size: 17px; margin: 0 0 4px; }
.muted { color: var(--muted); font-size: 13px; margin: 0; }
.error {
  margin: 12px 0 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 13px;
  white-space: pre-wrap;
}

.probe { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.probe .field { flex: 1 1 320px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field-inline { flex: 0 1 220px; }
.label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }

input[type="url"], input[type="text"], select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
}

input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn {
  border: 1px solid transparent;
  border-radius: 9px;
  padding: 10px 16px;
  font: inherit;
  font-weight: 550;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-primary[disabled] { opacity: .55; cursor: progress; }
.btn-ghost { background: transparent; color: var(--muted); border-color: var(--line); }
.btn-ghost:hover { color: var(--text); }
.btn-small { padding: 6px 10px; font-size: 13px; }

.meta { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 18px; }
.thumb { width: 160px; aspect-ratio: 16/9; object-fit: cover; border-radius: 9px; background: var(--surface-2); }
.meta-text { min-width: 0; }
.meta-text h2 { overflow-wrap: anywhere; }
#meta-duration:not(:empty)::before { content: " · "; }

.modes { display: flex; gap: 6px; padding: 4px; background: var(--surface-2); border-radius: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.mode {
  flex: 1 1 auto;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 8px 12px;
  border-radius: 7px;
  font: inherit;
  cursor: pointer;
}
.mode.is-active { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgb(0 0 0 / .25); }

.pane { margin-bottom: 18px; }
.pane[hidden] { display: none; }

.options {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 8px;
  margin-top: 8px;
  max-height: 290px;
  overflow: auto;
}

.opt {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-2);
  cursor: pointer;
}
.opt input { margin: 0; accent-color: var(--accent); }
.opt:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.opt-main { font-weight: 550; }
.opt-sub { color: var(--muted); font-size: 12px; margin-left: auto; }

.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.row.extras { margin-top: 14px; }
.check { display: inline-flex; align-items: center; gap: 7px; font-size: 14px; color: var(--muted); cursor: pointer; }
.check input { accent-color: var(--accent); }

.actions { display: flex; align-items: center; gap: 12px; margin-top: 20px; flex-wrap: wrap; }

.jobs-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.jobs { display: flex; flex-direction: column; gap: 10px; }

.job {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  background: var(--surface-2);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.job-head { display: flex; gap: 10px; align-items: baseline; justify-content: space-between; flex-wrap: wrap; }
.job-title { font-weight: 550; overflow-wrap: anywhere; }
.job-sub { color: var(--muted); font-size: 12.5px; }
.job-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.bar { height: 6px; border-radius: 99px; background: var(--line); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); transition: width .3s ease; }

.tag { font-size: 11.5px; padding: 2px 8px; border-radius: 99px; border: 1px solid var(--line); color: var(--muted); }
.tag.done { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 45%, transparent); }
.tag.error { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.tag.running { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 45%, transparent); }

@media (max-width: 560px) {
  .meta { flex-direction: column; }
  .thumb { width: 100%; }
  .options { grid-template-columns: 1fr; }
}
