:root {
  --bg: #f6f4f0;
  --surface: #ffffff;
  --surface-2: #f1eee8;
  --text: #1f1d1a;
  --muted: #6b665e;
  --border: #e3ded5;
  --accent: #2f6fde;
  --accent-text: #ffffff;
  --ok: #1f8a4c;
  --danger: #c43d32;
  --radius: 14px;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.04), 0 4px 16px rgb(0 0 0 / 0.05);
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161514;
    --surface: #1f1e1c;
    --surface-2: #2a2826;
    --text: #f0ede8;
    --muted: #a39d93;
    --border: #36332f;
    --accent: #5b8ff0;
    --ok: #4cc27f;
    --danger: #ef6b5f;
    --shadow: none;
  }
}

* { 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 {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 16px 48px;
  display: grid;
  gap: 16px;
}

.topbar {
  max-width: 640px;
  margin: 0 auto;
  padding: 20px 16px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

h1 { font-size: 1.35rem; margin: 0; }
h2 { font-size: 1rem; margin: 0 0 12px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}

label { display: block; font-weight: 600; margin-bottom: 6px; }

textarea, input[type="password"] {
  width: 100%;
  font: inherit;
  color: inherit;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  resize: vertical;
}

textarea:focus, input:focus-visible, .btn:focus-visible, .drop:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 20px;
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-text);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.btn.block { width: 100%; }

.link {
  background: none;
  border: 0;
  padding: 4px;
  color: var(--muted);
  font: inherit;
  cursor: pointer;
  text-decoration: underline;
}

.muted { color: var(--muted); }
.small { font-size: 0.875rem; }

.vk-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 8px; background: var(--muted); }
.dot.ok { background: var(--ok); }
.dot.bad { background: var(--danger); }

form.card { display: grid; gap: 14px; }

.drop {
  position: relative;
  display: grid;
  place-items: center;
  text-align: center;
  min-height: 120px;
  padding: 20px;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--muted);
  font-weight: 400;
  cursor: pointer;
  margin: 0;
}
.drop.over { border-color: var(--accent); color: var(--text); }
.drop strong { color: var(--text); }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.previews {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 8px;
}
.previews:empty { display: none; }
.previews li {
  position: relative;
  aspect-ratio: 1;
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface-2);
}
.previews img, .previews video { width: 100%; height: 100%; object-fit: cover; display: block; }
.previews .badge {
  position: absolute;
  left: 6px;
  bottom: 6px;
  padding: 1px 6px;
  border-radius: 6px;
  background: rgb(0 0 0 / 0.6);
  color: #fff;
  font-size: 0.75rem;
}
.previews .remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  background: rgb(0 0 0 / 0.6);
  color: #fff;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.progress { display: grid; gap: 4px; }
.track { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.track > div { height: 100%; width: 0; background: var(--accent); transition: width 0.2s; }

.msg { margin: 0; min-height: 1.5em; }
.msg.error { color: var(--danger); }
.msg.ok { color: var(--ok); }

.jobs { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.jobs li {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
}
.job-head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.job-caption { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status { font-size: 0.8rem; font-weight: 600; white-space: nowrap; }
.status.Done { color: var(--ok); }
.status.Failed { color: var(--danger); }
.jobs a { color: var(--accent); font-weight: 600; }

.login {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 16px;
}
.login .card { width: 100%; max-width: 360px; display: grid; gap: 14px; }
