:root {
  color-scheme: dark;
  --bg: #101318;
  --surface: #191e26;
  --line: #2c3440;
  --text: #edf0f4;
  --muted: #9aa5b4;
  --accent: #7c6df2;
  --accent-text: #ffffff;
  --ok: #4cc38a;
  --danger: #ff7b72;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

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

main { width: min(760px, 100%); margin: 0 auto; padding: 24px 16px 64px; }
header { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 24px; }
h1 { margin: 0; font-size: 1.5rem; }
#session { color: var(--muted); font-size: .9rem; white-space: nowrap; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 20px; }
#login-form { max-width: 380px; margin: 48px auto 0; display: grid; gap: 14px; }
.fields { display: grid; grid-template-columns: 1fr 120px; gap: 14px; margin-bottom: 16px; }

label { display: grid; gap: 6px; font-size: .9rem; color: var(--muted); }
input, select {
  width: 100%;
  min-height: 42px;
  padding: 8px 10px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
}
input:focus-visible, select:focus-visible, button:focus-visible, .drop:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

button { font: inherit; cursor: pointer; }
.primary {
  min-height: 42px;
  padding: 8px 22px;
  color: var(--accent-text);
  background: var(--accent);
  border: 0;
  border-radius: 8px;
  font-weight: 600;
}
.primary:disabled { opacity: .45; cursor: not-allowed; }
.link { padding: 0 0 0 10px; color: var(--muted); background: none; border: 0; text-decoration: underline; }

.tabs { display: flex; gap: 6px; margin-bottom: 16px; }
.tab { flex: 1; min-height: 42px; color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.tab[aria-selected="true"] { color: var(--text); border-color: var(--accent); }

.drop {
  display: grid;
  place-items: center;
  gap: 2px;
  padding: 36px 16px;
  text-align: center;
  background: var(--surface);
  border: 2px dashed var(--line);
  border-radius: 12px;
  cursor: pointer;
}
.drop strong { color: var(--text); font-size: 1.05rem; }
.drop.over { border-color: var(--accent); }
.drop input { position: absolute; width: 1px; height: 1px; min-height: 0; padding: 0; opacity: 0; }

.queue { display: grid; gap: 10px; margin: 16px 0; padding: 0; list-style: none; }
.item { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 14px; }
.item-head { display: flex; justify-content: space-between; align-items: start; gap: 12px; }
.name { min-width: 0; overflow-wrap: anywhere; font-weight: 600; }
.size { color: var(--muted); font-size: .85rem; white-space: nowrap; }
.movie-fields { display: grid; grid-template-columns: 1fr 96px; gap: 10px; margin-top: 10px; }
.dest { margin: 8px 0 0; color: var(--muted); font-size: .85rem; overflow-wrap: anywhere; }
.bar { height: 6px; margin-top: 10px; overflow: hidden; background: var(--bg); border-radius: 3px; }
.bar div { width: 0; height: 100%; background: var(--accent); transition: width .2s linear; }
.item.done .bar div { background: var(--ok); }
.state { margin: 6px 0 0; color: var(--muted); font-size: .85rem; }
.item.done .state { color: var(--ok); }
.item.failed .state { color: var(--danger); }

.actions { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.hint { margin: 0; color: var(--muted); font-size: .9rem; }
.error { min-height: 1.5em; margin: 0; color: var(--danger); font-size: .9rem; }

@media (max-width: 520px) {
  .fields, .movie-fields { grid-template-columns: 1fr; }
}
