:root {
  --bg: #070b16;
  --bg-soft: #0d1424;
  --card: rgba(19, 27, 46, 0.86);
  --card-solid: #131b2e;
  --border: rgba(120, 145, 200, 0.16);
  --border-strong: rgba(120, 145, 200, 0.3);
  --text: #e8eeff;
  --text-dim: #93a1c0;
  --text-faint: #6b7a99;
  --accent: #6366f1;
  --accent-2: #22d3ee;
  --ok: #34d399;
  --warn: #fbbf24;
  --danger: #f87171;
  --radius: 16px;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  font-synthesis: none;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background:
    radial-gradient(1200px 700px at 12% -10%, rgba(99, 102, 241, 0.28), transparent 60%),
    radial-gradient(900px 600px at 90% 0%, rgba(34, 211, 238, 0.16), transparent 55%),
    var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { width: min(1120px, 100% - 40px); margin: 0 auto; }
.wrap-narrow { width: min(460px, 100% - 32px); margin: 0 auto; }

/* ------------------------------- login ------------------------------- */
.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 0;
}

.login-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 34px 30px 28px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  width: 100%;
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 44px; height: 44px; border-radius: 13px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: grid; place-items: center;
  font-weight: 800; font-size: 19px; color: #06101f;
  box-shadow: 0 8px 22px rgba(99, 102, 241, 0.45);
  flex: none;
}
.brand-text b { display: block; font-size: 17px; letter-spacing: 0.3px; }
.brand-text span { display: block; font-size: 12px; color: var(--text-faint); letter-spacing: 1.6px; }

.login-title { margin: 26px 0 4px; font-size: 23px; letter-spacing: 0.4px; }
.login-sub { margin: 0 0 22px; color: var(--text-dim); font-size: 13.5px; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12.5px; color: var(--text-dim); margin-bottom: 7px; letter-spacing: 0.4px; }

input[type="text"], input[type="password"], input[type="number"], select, textarea {
  width: 100%;
  padding: 11px 13px;
  border-radius: 11px;
  border: 1px solid var(--border-strong);
  background: rgba(7, 11, 22, 0.72);
  color: var(--text);
  font-size: 14.5px;
  font-family: inherit;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  border-color: rgba(99, 102, 241, 0.75);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.16);
}
select option { background: #131b2e; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px;
  border-radius: 11px;
  border: 1px solid transparent;
  background: linear-gradient(135deg, var(--accent), #7c5cf5);
  color: #fff;
  font-size: 14.5px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: transform .12s, box-shadow .18s, opacity .18s;
  box-shadow: 0 10px 24px rgba(99, 102, 241, 0.3);
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 14px 30px rgba(99, 102, 241, 0.4); }
.btn:active { transform: translateY(0); }
.btn[disabled] { opacity: .55; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-block { width: 100%; }
.btn-ghost {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border-strong);
  color: var(--text);
  box-shadow: none;
  font-weight: 500;
}
.btn-ghost:hover { background: rgba(255, 255, 255, 0.08); box-shadow: none; }
.btn-sm { padding: 6px 11px; font-size: 12.5px; border-radius: 9px; }
.btn-danger { background: rgba(248, 113, 113, 0.14); border-color: rgba(248, 113, 113, 0.4); color: #fca5a5; box-shadow: none; }
.btn-danger:hover { background: rgba(248, 113, 113, 0.22); box-shadow: none; }

.alert {
  display: none;
  margin-bottom: 14px;
  padding: 10px 13px;
  border-radius: 10px;
  font-size: 13px;
  border: 1px solid rgba(248, 113, 113, 0.4);
  background: rgba(248, 113, 113, 0.12);
  color: #fca5a5;
}
.alert.show { display: block; }
.alert.ok { border-color: rgba(52, 211, 153, 0.4); background: rgba(52, 211, 153, 0.12); color: #6ee7b7; }

.login-foot { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--border); font-size: 12px; color: var(--text-faint); text-align: center; }

/* -------------------------------- app -------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  backdrop-filter: blur(16px);
  background: rgba(7, 11, 22, 0.78);
  border-bottom: 1px solid var(--border);
}
.topbar-inner { display: flex; align-items: center; gap: 16px; height: 64px; }
.topbar .brand-mark { width: 36px; height: 36px; border-radius: 11px; font-size: 16px; }
.topbar .spacer { flex: 1; }

.quota { display: flex; flex-direction: column; gap: 4px; min-width: 190px; }
.quota-label { font-size: 11.5px; color: var(--text-faint); display: flex; justify-content: space-between; gap: 10px; }
.quota-bar { height: 6px; border-radius: 99px; background: rgba(255,255,255,.08); overflow: hidden; }
.quota-fill { height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .4s; }

.user-chip { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-dim); }
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(135deg, rgba(99,102,241,.9), rgba(34,211,238,.85));
  display: grid; place-items: center; color: #06101f; font-weight: 700; font-size: 13px;
}

main { padding: 28px 0 64px; }

.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 22px;
  backdrop-filter: blur(12px);
}
.panel-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.panel-head h2 { margin: 0; font-size: 16.5px; letter-spacing: .3px; }
.panel-head .hint { font-size: 12.5px; color: var(--text-faint); margin-left: auto; }

.dropzone {
  border: 1.5px dashed var(--border-strong);
  border-radius: 14px;
  padding: 30px 18px;
  text-align: center;
  cursor: pointer;
  transition: border-color .18s, background .18s;
  background: rgba(255,255,255,.015);
}
.dropzone:hover, .dropzone.drag { border-color: rgba(99,102,241,.8); background: rgba(99,102,241,.1); }
.dropzone .dz-icon { font-size: 30px; line-height: 1; margin-bottom: 8px; }
.dropzone b { font-size: 14.5px; }
.dropzone p { margin: 6px 0 0; color: var(--text-faint); font-size: 12.5px; }

.upload-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-top: 16px; }
.upload-options .field { margin: 0; }

.queue { margin-top: 16px; display: flex; flex-direction: column; gap: 10px; }
.qitem {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  background: rgba(255,255,255,.022);
}
.qitem-top { display: flex; align-items: center; gap: 10px; font-size: 13.5px; }
.qitem-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qitem-meta { font-size: 12px; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.progress { height: 6px; border-radius: 99px; background: rgba(255,255,255,.08); overflow: hidden; margin-top: 9px; }
.progress > i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .25s; }
.qitem.done .progress > i { background: linear-gradient(90deg, #34d399, #22d3ee); }
.qitem.error { border-color: rgba(248,113,113,.45); }
.qitem.error .progress > i { background: var(--danger); }

table { width: 100%; border-collapse: collapse; }
thead th {
  text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .9px;
  color: var(--text-faint); font-weight: 600; padding: 0 12px 10px; border-bottom: 1px solid var(--border);
}
tbody td { padding: 13px 12px; border-bottom: 1px solid rgba(120,145,200,.08); font-size: 13.5px; vertical-align: middle; }
tbody tr:hover { background: rgba(99,102,241,.05); }
.fname { display: flex; align-items: center; gap: 10px; min-width: 0; }
.fname .ext {
  flex: none; width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center;
  font-size: 10px; font-weight: 700; letter-spacing: .5px;
  background: rgba(99,102,241,.18); color: #a5b4fc; text-transform: uppercase;
}
.fname .txt { min-width: 0; }
.fname .txt b { display: block; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 320px; }
.fname .txt small { color: var(--text-faint); font-size: 11.5px; }
.tag {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px; border-radius: 99px; font-size: 11.5px;
  border: 1px solid var(--border-strong); color: var(--text-dim);
}
.tag.warn { border-color: rgba(251,191,36,.4); color: #fcd34d; background: rgba(251,191,36,.1); }
.tag.ok { border-color: rgba(52,211,153,.35); color: #6ee7b7; background: rgba(52,211,153,.08); }
.actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }

.empty { text-align: center; padding: 44px 12px; color: var(--text-faint); }
.empty .big { font-size: 34px; margin-bottom: 10px; }

.mobile-only { display: none; }

/* ------------------------------ download ------------------------------ */
.dl-shell { min-height: 100vh; display: grid; place-items: center; padding: 34px 0; }
.dl-card {
  width: min(560px, 100% - 32px);
  background: var(--card); border: 1px solid var(--border); border-radius: 22px;
  padding: 28px; box-shadow: var(--shadow); backdrop-filter: blur(14px);
}
.dl-file { display: flex; gap: 14px; align-items: flex-start; margin: 20px 0 8px; }
.dl-file .ext { width: 48px; height: 48px; border-radius: 12px; font-size: 12px; }
.dl-file b { display: block; font-size: 16px; word-break: break-all; line-height: 1.4; }
.dl-meta { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 12.5px; color: var(--text-dim); margin: 14px 0 18px; }
.dl-meta span b { color: var(--text); font-weight: 500; }
.dl-actions { display: flex; flex-direction: column; gap: 10px; }
.dl-actions .row { display: flex; gap: 10px; flex-wrap: wrap; }
.dl-note { font-size: 12px; color: var(--text-faint); margin-top: 14px; }
.dl-progress { margin-top: 16px; display: none; }
.dl-progress.show { display: block; }

footer { text-align: center; color: var(--text-faint); font-size: 12px; padding: 22px 0 34px; }

@media (max-width: 760px) {
  .wrap { width: calc(100% - 24px); }
  .topbar-inner { height: auto; padding: 12px 0; flex-wrap: wrap; gap: 10px; }
  .quota { order: 3; width: 100%; }
  .panel { padding: 16px; }
  table, thead, tbody, th, td, tr { display: block; }
  thead { display: none; }
  tbody tr { border: 1px solid var(--border); border-radius: 12px; margin-bottom: 10px; padding: 6px 2px; }
  tbody td { border: 0; padding: 6px 12px; }
  tbody td::before { content: attr(data-label); display: block; font-size: 11px; color: var(--text-faint); text-transform: uppercase; letter-spacing: .7px; }
  .actions { justify-content: flex-start; }
  .fname .txt b { max-width: 100%; }
}
