:root {
  color-scheme: dark;
  --bg: #111310;
  --panel: #181b17;
  --panel-hover: #20251f;
  --surface: #141713;
  --text: #ecefe8;
  --muted: #8f998c;
  --line: #2a3028;
  --line-strong: #465143;
  --accent: #81917d;
  --accent-strong: #a6b2a1;
  --success: #78ad80;
  --warn: #c8a968;
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 20% 0%, #232a21 0, transparent 28rem),
    var(--bg);
  color: var(--text);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.topbar {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1000px;
  margin: auto;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
}

.brand {
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  letter-spacing: .15em;
  font-size: .76rem;
}

main {
  width: min(940px, calc(100% - 56px));
  margin: 42px auto 80px;
}

.title-row {
  display: flex;
  align-items: end;
  justify-content: space-between;
  margin-bottom: 20px;
}

.kicker {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .15em;
  font-size: .65rem;
  font-weight: 500;
}

h1 {
  margin: 5px 0 0;
  font-size: clamp(2.2rem, 6vw, 3.2rem);
  font-weight: 500;
  letter-spacing: -.055em;
  line-height: 1;
}

h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 550;
}

.connection {
  color: var(--muted);
  font-size: .72rem;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.login {
  max-width: 620px;
  margin: 14vh auto 0;
  padding: 28px;
}

.login h1 {
  margin-bottom: 22px;
  font-size: 2rem;
}

.inline-form,
.url-row {
  display: flex;
  gap: 10px;
}

input[type="text"],
input[type="password"] {
  width: 100%;
  min-width: 0;
  padding: 13px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--text);
  outline: none;
}

input::placeholder {
  color: #717a6e;
}

input:focus {
  border-color: var(--line-strong);
  box-shadow: 0 0 0 3px rgba(129, 145, 125, .10);
}

button {
  padding: 12px 17px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--line-strong);
  color: var(--text);
  font-weight: 600;
}

button:hover {
  background: #53604f;
}

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

.ghost {
  padding: 8px 11px;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: .72rem;
}

.ghost:hover {
  background: var(--panel-hover);
  border-color: var(--line-strong);
  color: var(--text);
}

.importer-card {
  overflow: hidden;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-bottom: 1px solid var(--line);
}

.tab {
  position: relative;
  padding: 17px 10px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 550;
}

.tab:hover {
  background: var(--panel-hover);
  color: var(--text);
}

.tab.active {
  background: #1d211c;
  color: var(--text);
}

.tab.active::after {
  content: "";
  position: absolute;
  left: 22%;
  right: 22%;
  bottom: -1px;
  height: 2px;
  background: var(--accent-strong);
  border-radius: 3px;
}

.tab span {
  margin-left: 7px;
}

.import-form {
  padding: 26px;
}

label {
  font-size: .8rem;
  font-weight: 600;
}

.url-row {
  margin-top: 9px;
}

.url-row button {
  min-width: 140px;
  white-space: nowrap;
}

.hint {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: .74rem;
}

.legal {
  margin: 13px 2px 34px;
  color: #778174;
  font-size: .68rem;
}

.video-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 22px;
}

.option-label {
  grid-column: 1 / -1;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .12em;
  font-size: .65rem;
}

.choice {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 13px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 7px;
  cursor: pointer;
}

.choice:hover {
  background: var(--panel-hover);
}

.choice:has(input:checked) {
  background: #1d211c;
  border-color: var(--line-strong);
}

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

.choice span {
  display: flex;
  flex-direction: column;
}

.choice strong {
  font-size: .8rem;
}

.choice small {
  margin-top: 2px;
  color: var(--muted);
  font-size: .68rem;
  font-weight: 400;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.history {
  margin-top: 0;
}

.jobs {
  border-top: 1px solid var(--line);
}

.job {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 16px;
  padding: 16px 4px;
  border-bottom: 1px solid var(--line);
}

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

.job-title {
  display: flex;
  gap: 9px;
  align-items: center;
  min-width: 0;
}

.job-title strong {
  overflow: hidden;
  font-size: .8rem;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.badge {
  flex: 0 0 auto;
  padding: 2px 7px;
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  color: #b9c3b5;
  font-size: .62rem;
}

.source {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: .68rem;
  overflow-wrap: anywhere;
}

.job-status {
  align-self: center;
  color: var(--muted);
  font-size: .68rem;
  text-align: right;
}

.job-status .done {
  color: var(--success);
}

.job-status .problem {
  color: var(--warn);
}

.job-progress {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 10px;
}

.job-progress progress {
  flex: 1;
  height: 5px;
  accent-color: var(--accent);
}

.counts {
  color: var(--muted);
  font-size: .62rem;
  white-space: nowrap;
}

.actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 7px;
}

.actions button {
  padding: 5px 8px;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: .62rem;
}

.actions button:hover {
  background: var(--panel-hover);
  border-color: var(--line-strong);
  color: var(--text);
}

.empty {
  padding: 28px 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: .8rem;
}

.detail {
  margin-top: 25px;
  padding: 20px;
}

pre {
  max-height: 320px;
  overflow: auto;
  color: var(--muted);
  font-size: .68rem;
  white-space: pre-wrap;
}

.detail .section-heading {
  margin-bottom: 4px;
}

#message {
  margin-top: 16px;
  color: var(--warn);
  font-size: .74rem;
}

[hidden] {
  display: none !important;
}

@media (max-width: 680px) {
  .topbar {
    padding: 0 16px;
  }

  main {
    width: calc(100% - 32px);
    margin-top: 28px;
  }

  .tabs {
    grid-template-columns: 1fr 1fr;
  }

  .tab:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }

  .tab span {
    margin-left: 4px;
  }

  .url-row,
  .inline-form {
    flex-direction: column;
  }

  .url-row button {
    width: 100%;
  }

  .video-options {
    grid-template-columns: 1fr;
  }

  .option-label {
    grid-column: auto;
  }

  .title-row {
    align-items: start;
  }

  .job {
    grid-template-columns: 1fr;
  }

  .job-status {
    text-align: left;
  }

  .job-progress,
  .actions {
    grid-column: auto;
  }
}
