:root,
html[data-theme="dark"] {
  --bg: #0f1216;
  --card: #171c22;
  --line: #262d36;
  --text: #e6ebf1;
  --muted: #8b97a5;
  --accent: #3b82f6;
  --accent-contrast: #ffffff;
  --ready: #22c55e;
  --busy: #eab308;
  --needed: #4b5563;
  --error: #ef4444;
  --input-bg: #0d1116;
  --row-alt: #1b2129;
  --bar-bg: #0d1116;
  --drop-border: #39424e;
  --drop-over: #142033;
  --notice-bg: #142033;
  --notice-border: #2b4a7a;
  --notice-text: #cfe1ff;
  --disabled-bg: #2b323c;
  --disabled-text: #6b7480;
}

html[data-theme="light"] {
  --bg: #f5f7fa;
  --card: #ffffff;
  --line: #e2e6ec;
  --text: #1a2027;
  --muted: #5b6673;
  --accent: #2563eb;
  --accent-contrast: #ffffff;
  --ready: #16a34a;
  --busy: #d97706;
  --needed: #9aa4b1;
  --error: #dc2626;
  --input-bg: #ffffff;
  --row-alt: #f2f5f9;
  --bar-bg: #e6eaf0;
  --drop-border: #c7cfda;
  --drop-over: #e8f0fe;
  --notice-bg: #e8f0fe;
  --notice-border: #b6cdf7;
  --notice-text: #1e3a8a;
  --disabled-bg: #e5e8ec;
  --disabled-text: #9aa4b1;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
header {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
  padding: 24px 64px 8px 28px;
  max-width: 880px;
  margin: 0 auto;
}
h1 { margin: 0; font-size: 20px; }
h2 { margin: 0; font-size: 15px; }
.sub { margin: 4px 0 0; color: var(--muted); }
main { max-width: 880px; margin: 0 auto; padding: 12px 28px 64px; display: grid; gap: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 18px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.summary { color: var(--muted); }
.hidden { display: none; }

html, body { height: 100%; }
.gate { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.gate-card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 32px; max-width: 420px; width: 100%; text-align: center; }
.gate-card h1 { font-size: 22px; margin: 0 0 8px; }
.gate-card p { margin: 0 0 18px; }
button.big { width: 100%; padding: 12px; font-size: 15px; }
.error { color: var(--error); min-height: 18px; margin: 10px 0 0; font-size: 13px; }
.gate .settings { text-align: left; margin-top: 18px; }
.gate .settings input { width: 100%; }
#topbar, #app { display: none; }
body.authed #topbar { display: flex; }
body.authed #app { display: grid; }
body.authed #loginGate { display: none; }
body:not(.authed) { overflow: hidden; }
#theme {
  position: fixed; top: 16px; right: 16px; z-index: 20; width: 38px; height: 38px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center; border-radius: 10px;
  background: var(--card); color: var(--text); border: 1px solid var(--line);
}
#theme:hover { border-color: var(--accent); }
html[data-theme="dark"] #theme .i-sun { display: none; }
html[data-theme="light"] #theme .i-moon { display: none; }
.account { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.muted { color: var(--muted); }
button.ghost { background: transparent; border: 1px solid var(--line); color: var(--text); }
.notice { background: var(--notice-bg); border: 1px solid var(--notice-border); color: var(--notice-text); padding: 10px 12px; border-radius: 8px; margin: 0; }
.settings summary { cursor: pointer; color: var(--muted); }
.settings label { display: block; margin-top: 10px; color: var(--muted); }
.settings input { width: 260px; margin-top: 6px; padding: 7px 9px; border-radius: 7px; border: 1px solid var(--line); background: var(--input-bg); color: var(--text); }
.hint { color: var(--muted); margin: 8px 0 0; }

.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  padding: 34px; border: 1.5px dashed var(--drop-border); border-radius: 10px; cursor: pointer; text-align: center;
}
.dropzone:hover, .dropzone:focus { border-color: var(--accent); outline: none; }
.dropzone.over { border-color: var(--accent); background: var(--drop-over); }
.dropzone span { color: var(--muted); }

.bar { height: 8px; background: var(--bar-bg); border-radius: 999px; overflow: hidden; margin-bottom: 14px; }
#overallBar { height: 100%; width: 0%; background: var(--accent); transition: width .25s ease; }

.checklist, .extras, .uploads { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.checklist li, .extras li, .uploads li {
  display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 7px;
}
.checklist li:nth-child(odd), .uploads li:nth-child(odd) { background: var(--row-alt); }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--needed); flex: 0 0 auto; }
.dot.ready { background: var(--ready); }
.dot.busy { background: var(--busy); animation: pulse 1s infinite; }
.dot.error { background: var(--error); }
@keyframes pulse { 50% { opacity: .35; } }
.name { flex: 0 0 300px; }
.stream { color: var(--muted); flex: 0 0 170px; }
.meta { color: var(--muted); margin-left: auto; text-align: right; }
.item.busy .name { color: var(--busy); }
button {
  padding: 9px 18px; border-radius: 8px; border: 0; background: var(--accent); color: var(--accent-contrast);
  font-weight: 600; cursor: pointer; white-space: nowrap;
}
button:disabled { background: var(--disabled-bg); color: var(--disabled-text); cursor: not-allowed; }
.uploads .meta { min-width: 120px; }
.uploads .sub { color: var(--muted); font-size: 13px; }
