:root {
  --bg: #0e1117;
  --panel: #161b22;
  --panel-2: #1c2330;
  --line: #2a3240;
  --text: #e6edf3;
  --muted: #8b98a9;
  --accent: #3b82f6;
  --accent-2: #60a5fa;
  --ok: #22c55e;
  --warn: #f59e0b;
  --err: #ef4444;
  --radius: 10px;
}

* { box-sizing: border-box; }

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

a { color: var(--accent-2); }

/* ---------- layout ---------- */
header {
  display: flex; align-items: center; gap: 16px;
  padding: 14px 20px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
header h1 { font-size: 17px; margin: 0; font-weight: 650; letter-spacing: -.01em; }
header .spacer { flex: 1; }

.stats { display: flex; gap: 18px; font-size: 13px; color: var(--muted); }
.stats b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }

main { max-width: 1000px; margin: 0 auto; padding: 20px; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 18px;
}
.card h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em;
           color: var(--muted); margin: 0 0 12px; font-weight: 600; }

/* ---------- controls ---------- */
.row { display: flex; gap: 10px; flex-wrap: wrap; }
input[type=text], input[type=password] {
  flex: 1; min-width: 220px;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 12px; font: inherit;
}
input:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }

button {
  background: var(--accent); color: #fff; border: 0;
  border-radius: 8px; padding: 10px 16px;
  font: inherit; font-weight: 600; cursor: pointer;
}
button:hover { background: var(--accent-2); }
button.ghost { background: transparent; border: 1px solid var(--line); color: var(--muted); font-weight: 500; }
button.ghost:hover { color: var(--text); border-color: var(--muted); background: transparent; }
button.danger:hover { color: var(--err); border-color: var(--err); }
button:disabled { opacity: .5; cursor: not-allowed; }

label.file {
  display: inline-flex; align-items: center;
  border: 1px dashed var(--line); border-radius: 8px;
  padding: 10px 16px; color: var(--muted); cursor: pointer;
}
label.file:hover { color: var(--text); border-color: var(--muted); }
label.file input { display: none; }

/* ---------- transfers ---------- */
.transfer { padding: 12px 0; border-bottom: 1px solid var(--line); }
.transfer:last-child { border-bottom: 0; }
.transfer .top { display: flex; align-items: baseline; gap: 10px; }
.transfer .name {
  flex: 1; font-weight: 550; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.transfer .pct { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 13px; }

.bar { height: 6px; background: var(--panel-2); border-radius: 99px; margin: 8px 0 6px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 99px;
           transition: width .4s ease; }
.transfer.complete .bar > i { background: var(--ok); }
.transfer.error   .bar > i { background: var(--err); }

.meta { display: flex; gap: 14px; align-items: center; font-size: 12.5px; color: var(--muted);
        font-variant-numeric: tabular-nums; }
.meta .grow { flex: 1; }
.meta button { padding: 4px 10px; font-size: 12.5px; }

.badge { font-size: 11px; padding: 2px 7px; border-radius: 99px; border: 1px solid var(--line); }
.badge.active   { color: var(--accent-2); border-color: var(--accent); }
.badge.complete { color: var(--ok); border-color: var(--ok); }
.badge.paused   { color: var(--warn); border-color: var(--warn); }
.badge.error    { color: var(--err); border-color: var(--err); }

/* ---------- files ---------- */
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.crumbs a { cursor: pointer; }

.file { display: flex; align-items: center; gap: 12px; padding: 9px 0;
        border-bottom: 1px solid var(--line); }
.file:last-child { border-bottom: 0; }
.file .icon { width: 18px; text-align: center; color: var(--muted); }
.file .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file .name a { cursor: pointer; text-decoration: none; color: var(--text); }
.file .name a:hover { color: var(--accent-2); }
.file .size { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums;
              white-space: nowrap; }
.file .pick { width: 15px; height: 15px; accent-color: var(--accent); cursor: pointer; flex: none; }
.file button { padding: 4px 10px; font-size: 12.5px; }

.btn-link {
  font-size: 12.5px; padding: 4px 10px; border-radius: 8px;
  border: 1px solid var(--line); color: var(--muted);
  text-decoration: none; white-space: nowrap;
}
.btn-link:hover { color: var(--accent-2); border-color: var(--accent); }

textarea {
  width: 100%; margin-top: 12px; resize: vertical;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 12px; font: inherit; font-size: 13.5px;
}
textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }

.hint { color: var(--muted); font-size: 13px; align-self: center; }

@media (max-width: 640px) {
  .file .size { display: none; }
  main { padding: 12px; }
  header { padding: 12px 14px; }
  .stats { gap: 12px; font-size: 12px; }
}

.empty { color: var(--muted); font-size: 14px; padding: 10px 0; }

/* ---------- toast ---------- */
#toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--panel-2); border: 1px solid var(--line); color: var(--text);
  padding: 11px 18px; border-radius: 8px; font-size: 14px;
  opacity: 0; pointer-events: none; transition: all .25s ease; max-width: 90vw;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.err { border-color: var(--err); color: #fecaca; }

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { width: 100%; max-width: 340px; background: var(--panel);
              border: 1px solid var(--line); border-radius: 14px; padding: 28px; }
.login-card h1 { font-size: 20px; margin: 0 0 4px; }
.login-card p { color: var(--muted); font-size: 13.5px; margin: 0 0 20px; }
.login-card input { width: 100%; margin-bottom: 10px; }
.login-card button { width: 100%; margin-top: 6px; }
.login-card .err { color: #fca5a5; font-size: 13.5px; min-height: 20px; margin-top: 10px; }
