:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --text: #1c1f23;
  --muted: #6b7280;
  --line: #e5e7eb;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --danger: #dc2626;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 4px 16px rgba(16, 24, 40, .06);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161a;
    --card: #1c1f24;
    --text: #e6e8eb;
    --muted: #9aa1ac;
    --line: #2b2f36;
    --accent: #3b82f6;
    --accent-hover: #60a5fa;
    --danger: #f87171;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Microsoft YaHei", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

/* ------------------------------------------------------------- buttons */
.btn {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  transition: background .15s, border-color .15s, opacity .15s;
}
.btn:hover { border-color: var(--accent); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.ghost { background: transparent; }
.small-btn { padding: 4px 10px; font-size: 12px; }

/* --------------------------------------------------------------- login */
.login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-card {
  width: 100%;
  max-width: 340px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 32px 28px;
  text-align: center;
}
.login-icon { font-size: 34px; }
.login-card h1 { margin: 10px 0 4px; font-size: 20px; }
.login-card p { margin: 0 0 20px; }
.login-card input {
  width: 100%;
  padding: 10px 12px;
  font-size: 16px;
  text-align: center;
  letter-spacing: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  margin-bottom: 12px;
}
.login-card input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.login-card .btn { width: 100%; }
.error { color: var(--danger); font-size: 13px; margin-top: 12px; }

/* -------------------------------------------------------------- layout */
.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 20px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 16px; }
.brand-icon { font-size: 18px; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.topbar-actions input[type=search] {
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  min-width: 180px;
}
.main { max-width: 980px; margin: 0 auto; padding: 20px; }

/* ------------------------------------------------------------ dropzone */
.dropzone {
  border: 2px dashed var(--line);
  border-radius: 12px;
  padding: 26px;
  text-align: center;
  color: var(--muted);
  background: var(--card);
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.over { border-color: var(--accent); }
.dz-icon { font-size: 22px; margin-bottom: 6px; }

/* ------------------------------------------------------ upload progress */
.uploads { margin-top: 14px; display: grid; gap: 8px; }
.up-item {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 14px;
}
.up-row { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }
.up-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar { height: 4px; border-radius: 4px; background: var(--line); margin-top: 8px; overflow: hidden; }
.bar > i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.up-item.failed .bar > i { background: var(--danger); }

/* ---------------------------------------------------------- file table */
.list-card {
  margin-top: 18px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
}
table.list { width: 100%; border-collapse: collapse; }
table.list th {
  text-align: left;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--text); }
table.list td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
table.list tr:last-child td { border-bottom: none; }
table.list tbody tr:hover { background: rgba(127, 127, 127, .07); }
.col-icon { width: 44px; }
.col-size, .col-time { width: 1%; white-space: nowrap; color: var(--muted); font-variant-numeric: tabular-nums; }
.col-act { width: 1%; white-space: nowrap; text-align: right; }
.fname { word-break: break-all; }
.icon { width: 26px; height: 26px; display: block; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
a.dl {
  display: inline-block;
  padding: 4px 12px;
  font-size: 12px;
  border-radius: 6px;
  border: 1px solid var(--line);
  color: var(--text);
  text-decoration: none;
}
a.dl:hover { border-color: var(--accent); color: var(--accent); }
button.del {
  padding: 4px 10px;
  font-size: 12px;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
button.del:hover { color: var(--danger); border-color: var(--danger); }
.empty { padding: 34px; text-align: center; color: var(--muted); }

/* --------------------------------------------------------- drag overlay */
.drag-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(37, 99, 235, .12);
  border: 3px dashed var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 600;
  color: var(--accent);
  pointer-events: none;
}

/* ---------------------------------------------------------------- toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  z-index: 30;
  background: #111827;
  color: #fff;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 13px;
  box-shadow: var(--shadow);
}
.toast.bad { background: var(--danger); }

@media (max-width: 620px) {
  .col-time { display: none; }
  .topbar-actions input[type=search] { min-width: 120px; flex: 1; }
  .topbar { gap: 8px; }
}
