:root {
  --bg: #0f1115;
  --panel: #161a21;
  --panel2: #1c222b;
  --line: #262d38;
  --text: #e6e8ee;
  --dim: #8b93a7;
  --accent: #4c8dff;
  --danger: #e2544a;
  --ok: #35b37e;
  --radius: 10px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, "Segoe UI", "Microsoft JhengHei", "PingFang HK", sans-serif;
  -webkit-text-size-adjust: 100%;
}

button, input, select { font: inherit; color: inherit; }

.hidden { display: none !important; }

/* ---------- login ---------- */

#login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.card {
  width: 100%;
  max-width: 360px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 28px 24px;
}

.card h1 {
  margin: 0 0 4px;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: .5px;
}

.card p.sub {
  margin: 0 0 22px;
  color: var(--dim);
  font-size: 13px;
}

.field { margin-bottom: 14px; }

.field label {
  display: block;
  font-size: 12px;
  color: var(--dim);
  margin-bottom: 6px;
}

.field input {
  width: 100%;
  padding: 11px 12px;
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  outline: none;
}

.field input:focus { border-color: var(--accent); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 14px;
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
}

.btn:hover { border-color: #38414f; }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .45; cursor: default; }

.btn.primary {
  width: 100%;
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 500;
  padding: 12px;
}

.btn.icon { padding: 6px 9px; font-size: 13px; }
.btn.danger { color: var(--danger); }

.err {
  margin-top: 14px;
  color: var(--danger);
  font-size: 13px;
  min-height: 18px;
}

/* ---------- app shell ---------- */

header {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: rgba(15, 17, 21, .92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

header .brand { font-weight: 600; font-size: 15px; white-space: nowrap; }

header .disk {
  font-size: 12px;
  color: var(--dim);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 10px;
  white-space: nowrap;
}

header .spacer { flex: 1; }

main { padding: 12px 16px 96px; max-width: 960px; margin: 0 auto; }

.crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px;
  font-size: 13px;
  margin-bottom: 12px;
  color: var(--dim);
  word-break: break-all;
}

.crumbs a { color: var(--accent); cursor: pointer; text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }
.crumbs span.sep { opacity: .5; padding: 0 2px; }

.toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

ul.list {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--panel);
}

ul.list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

ul.list li:last-child { border-bottom: none; }
ul.list li:hover { background: var(--panel2); }

.nm {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.nm.dir { color: var(--accent); font-weight: 500; }

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

.acts { display: flex; gap: 4px; flex-shrink: 0; }

.empty { padding: 28px 12px; text-align: center; color: var(--dim); font-size: 13px; }

/* ---------- progress ---------- */

#prog {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: var(--panel);
  border-top: 1px solid var(--line);
  padding: 10px 16px;
  font-size: 13px;
  z-index: 10;
}

#prog .bar { height: 4px; background: var(--panel2); border-radius: 2px; margin-top: 8px; overflow: hidden; }
#prog .bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .15s; }

/* ---------- toast ---------- */

#toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  background: #232a35;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 18px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
  z-index: 20;
  max-width: 90vw;
  text-align: center;
}

#toast.on { opacity: 1; }
#toast.err { border-color: var(--danger); color: #ffb4ae; }

@media (max-width: 560px) {
  .meta.size { display: none; }
  main { padding: 10px 10px 96px; }
  header { padding: 10px 12px; }
}
