:root {
  --bg: #0f1115;
  --panel: #171a21;
  --panel-2: #1e222b;
  --line: #2a2f3a;
  --text: #e6e9ef;
  --muted: #9aa4b2;
  --accent: #4f8cff;
  --ok: #3fb950;
  --warn: #d29922;
  --err: #f85149;
  --radius: 10px;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f5f6f8;
    --panel: #ffffff;
    --panel-2: #f0f2f5;
    --line: #dfe3ea;
    --text: #1b1f27;
    --muted: #5d6672;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.6 system-ui, -apple-system, 'Segoe UI', 'Microsoft YaHei', sans-serif;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar h1 {
  font-size: 17px;
  margin: 0;
}

.limits {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

main {
  max-width: 980px;
  margin: 0 auto;
  padding: 24px;
  display: grid;
  gap: 16px;
}

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

.panel h2 {
  font-size: 14px;
  margin: 0 0 12px;
  color: var(--muted);
  font-weight: 600;
  letter-spacing: 0.02em;
}

.row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.row.between {
  justify-content: space-between;
}

.row.between h2 {
  margin: 0;
}

input[type='password'],
input[type='text'],
input:not([type]) {
  flex: 1;
  min-width: 0;
  padding: 9px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  font: inherit;
}

input:focus-visible,
button:focus-visible,
.dropzone:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

button {
  padding: 9px 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

button:hover {
  border-color: var(--muted);
}

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

button.small {
  padding: 5px 10px;
  font-size: 12px;
}

button.ghost {
  background: transparent;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.dropzone {
  display: grid;
  gap: 6px;
  place-items: center;
  padding: 36px 20px;
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.dropzone strong {
  color: var(--text);
  font-size: 15px;
}

.dropzone.dragging {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}

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

.error {
  color: var(--err);
  font-size: 12px;
  margin: 10px 0 0;
}

.empty {
  color: var(--muted);
  font-size: 12px;
  margin: 8px 0 0;
}

.tasks {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.task {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--panel-2);
  display: grid;
  gap: 8px;
}

.task-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
}

.task-name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-meta {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.bar {
  height: 6px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--muted) 25%, transparent);
  overflow: hidden;
}

.bar > i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width 0.2s ease;
}

.task[data-status='done'] .bar > i {
  background: var(--ok);
}

.task[data-status='error'] .bar > i {
  background: var(--err);
}

.task[data-status='paused'] .bar > i {
  background: var(--warn);
}

.task-foot {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.status-text {
  font-size: 12px;
  color: var(--muted);
}

.objects {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.objects th,
.objects td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
}

.objects th {
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
}

.objects td.key {
  word-break: break-all;
  font-family: ui-monospace, 'Cascadia Code', Consolas, monospace;
  font-size: 12px;
}

.objects .num {
  text-align: right;
  white-space: nowrap;
}

.objects tbody tr:hover {
  background: color-mix(in srgb, var(--accent) 6%, transparent);
}

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

.link:hover {
  text-decoration: underline;
}

@media (max-width: 640px) {
  main {
    padding: 12px;
  }
  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }
  .limits {
    text-align: left;
  }
}
