:root {
  --bg: #0f1419;
  --card: #1a2332;
  --border: #2d3a4f;
  --text: #e7ecf3;
  --muted: #8b9cb3;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --success: #22c55e;
  --error: #ef4444;
  --warning: #f59e0b;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

header { margin-bottom: 2rem; }
.header-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1.5rem;
  align-items: flex-start;
}
.auth-panel { min-width: 260px; }
.auth-user { font-weight: 600; margin-bottom: 0.25rem; }
.auth-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.5rem; }
.btn-secondary {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.45rem 0.75rem;
  font-size: 0.85rem;
}
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }
header h1 { font-size: 2rem; font-weight: 700; }
.subtitle { color: var(--muted); margin-top: 0.25rem; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.card h2 { font-size: 1.1rem; margin-bottom: 1rem; }

label { display: block; font-size: 0.875rem; color: var(--muted); margin-bottom: 0.35rem; }

input[type="url"], input[type="file"], select, textarea {
  width: 100%;
  padding: 0.65rem 0.85rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.95rem;
  margin-bottom: 0.75rem;
}

textarea { resize: vertical; font-family: monospace; }

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  margin-bottom: 0.75rem;
}

.row select { width: auto; min-width: 120px; margin-bottom: 0; }

.checkbox {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text);
  cursor: pointer;
}

.checkbox input { width: auto; margin: 0; }

button {
  background: var(--accent);
  color: white;
  border: none;
  padding: 0.65rem 1.25rem;
  border-radius: 8px;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.15s;
}

button:hover { background: var(--accent-hover); }

.hint { font-size: 0.85rem; color: var(--muted); margin-bottom: 0.75rem; }

.jobs-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.jobs-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.hidden { display: none !important; }

.jobs-toolbar.hidden { display: none; }

.btn-danger {
  background: #b91c1c;
}

.btn-danger:hover { background: #991b1b; }

.col-check { width: 36px; text-align: center; }

td.col-check, th.col-check { text-align: center; }

.file-missing { font-size: 0.75rem; color: var(--muted); }

.badge {
  font-size: 0.75rem;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  background: var(--border);
  color: var(--muted);
}

.badge.ok { background: rgba(34, 197, 94, 0.2); color: var(--success); }

table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }

th, td {
  text-align: left;
  padding: 0.6rem 0.5rem;
  border-bottom: 1px solid var(--border);
}

th { color: var(--muted); font-weight: 500; }

.status {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  text-transform: uppercase;
}

.status.pending { background: rgba(139, 156, 179, 0.2); color: var(--muted); }
.status.downloading { background: rgba(59, 130, 246, 0.2); color: var(--accent); }
.status.completed { background: rgba(34, 197, 94, 0.2); color: var(--success); }
.status.failed { background: rgba(239, 68, 68, 0.2); color: var(--error); }
.status.uploading { background: rgba(168, 85, 247, 0.2); color: #a855f7; }
.status.cancelled { background: rgba(245, 158, 11, 0.2); color: var(--warning); }

.yadisk-folder-wrap {
  width: 100%;
  margin-bottom: 0.35rem;
}

#yadisk-folder {
  max-width: 320px;
}

#yadisk-folder.hidden {
  display: none;
}

.hint-inline { font-size: 0.75rem; color: var(--success); margin-right: 0.5rem; }

.progress-bar {
  width: 80px;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  transition: width 0.3s;
}

.actions a, .actions button.link {
  color: var(--accent);
  background: none;
  border: none;
  padding: 0;
  font-size: 0.85rem;
  cursor: pointer;
  text-decoration: none;
  margin-right: 0.5rem;
}

.actions button.link { color: var(--error); }

.err {
  display: block;
  font-size: 0.75rem;
  color: var(--error);
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  padding: 0.85rem 1.25rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  z-index: 100;
}

.toast.hidden { display: none; }
.toast.error { border-color: var(--error); }

@media (max-width: 640px) {
  table { font-size: 0.75rem; }
  th:nth-child(3), td:nth-child(3) { max-width: 100px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}
