:root {
  --bg: #0b0f14;
  --bg2: #121820;
  --bg3: #1a222d;
  --border: #243041;
  --text: #e6edf5;
  --muted: #8b9bb0;
  --accent: #3d9eff;
  --accent2: #00d4aa;
  --danger: #ff5c7a;
  --radius: 12px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
  --font: "Segoe UI", system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
}

body {
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(61, 158, 255, 0.12), transparent),
    radial-gradient(ellipse 60% 40% at 100% 100%, rgba(0, 212, 170, 0.06), transparent);
}

.view {
  min-height: 100%;
}

/* hidden must win over #login-view { display:flex } */
.view[hidden],
#login-view[hidden],
#app-view[hidden],
[hidden] {
  display: none !important;
}

/* ---------- 登录 ---------- */
#login-view {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 36px 32px;
  box-shadow: var(--shadow);
}

.logo {
  text-align: center;
  margin-bottom: 28px;
}

.logo-mark {
  display: inline-flex;
  width: 48px;
  height: 48px;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-radius: 12px;
  color: #fff;
  margin-bottom: 12px;
}

.logo h1 {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.tagline {
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 6px;
}

#login-form label {
  display: block;
  margin-bottom: 16px;
}

#login-form label span {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 6px;
}

#login-form input {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.15s;
}

#login-form input:focus {
  border-color: var(--accent);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s, transform 0.1s;
}

.btn:active {
  transform: scale(0.98);
}

.btn.primary {
  width: 100%;
  margin-top: 8px;
  background: linear-gradient(135deg, var(--accent), #2b7fd4);
  color: #fff;
}

.btn.primary:hover {
  opacity: 0.92;
}

.btn.ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}

.btn.ghost:hover {
  color: var(--text);
  border-color: var(--muted);
}

.btn.danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid transparent;
}

.btn.danger:hover {
  background: rgba(255, 92, 122, 0.12);
}

.btn.sm {
  padding: 6px 10px;
  font-size: 0.8rem;
}

.error {
  color: var(--danger);
  font-size: 0.85rem;
  margin-top: 12px;
  text-align: center;
}

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

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 20px;
  background: rgba(18, 24, 32, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}

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

.brand .logo-mark {
  width: 32px;
  height: 32px;
  font-size: 16px;
  margin: 0;
}

.stats {
  flex: 1;
  color: var(--muted);
  font-size: 0.85rem;
}

.actions {
  display: flex;
  gap: 8px;
}

/* ---------- 主区 ---------- */
.main {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 16px 48px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  background: var(--bg2);
  padding: 28px 20px;
  transition: border-color 0.2s, background 0.2s;
}

.dropzone.dragover {
  border-color: var(--accent);
  background: rgba(61, 158, 255, 0.08);
}

.drop-inner {
  text-align: center;
}

.drop-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: var(--bg3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  color: var(--accent);
}

.hint {
  color: var(--muted);
  font-size: 0.8rem;
  margin-top: 8px;
}

.upload-list {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.upload-item {
  background: var(--bg3);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 0.85rem;
}

.upload-item .row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
}

.upload-item .name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 70%;
}

.progress {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.progress > i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  width: 0%;
  transition: width 0.2s;
}

/* ---------- 文件列表 ---------- */
.file-panel {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.panel-head h2 {
  font-size: 1rem;
  font-weight: 600;
}

.panel-head input {
  width: 180px;
  padding: 8px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.85rem;
  outline: none;
}

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

.file-list {
  min-height: 120px;
}

.empty {
  padding: 40px 16px;
  text-align: center;
  color: var(--muted);
}

.file-row {
  display: grid;
  grid-template-columns: 40px 1fr auto auto;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  transition: background 0.12s;
}

.file-row:last-child {
  border-bottom: none;
}

.file-row:hover {
  background: var(--bg3);
}

.file-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.file-meta .name {
  font-weight: 500;
  word-break: break-all;
}

.file-meta .sub {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 2px;
}

.file-ops {
  display: flex;
  gap: 4px;
}

/* ---------- 弹层 ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal[hidden] {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
}

.modal-body {
  position: relative;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 12px;
  max-width: 90vw;
  max-height: 90vh;
  overflow: auto;
  padding: 16px;
  box-shadow: var(--shadow);
}

.modal-close {
  position: absolute;
  top: 8px;
  right: 12px;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.5rem;
  cursor: pointer;
  z-index: 2;
}

#preview-content img,
#preview-content video {
  max-width: 100%;
  max-height: 80vh;
  display: block;
  border-radius: 8px;
}

#preview-content audio {
  width: 100%;
  min-width: 280px;
}

#preview-content pre {
  max-width: 80vw;
  max-height: 70vh;
  overflow: auto;
  background: var(--bg);
  padding: 12px;
  border-radius: 8px;
  font-size: 0.85rem;
  white-space: pre-wrap;
  word-break: break-all;
}

@media (max-width: 600px) {
  .file-row {
    grid-template-columns: 36px 1fr;
    grid-template-rows: auto auto;
  }
  .file-ops {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }
  .panel-head input {
    width: 120px;
  }
}


.enc-row {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: center;
}
.enc-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}
.enc-check input { accent-color: var(--accent); width: 16px; height: 16px; }
.enc-pass {
  padding: 8px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.85rem;
  min-width: 200px;
  outline: none;
}
.enc-pass:focus { border-color: var(--accent); }
.badge-enc {
  display: inline-block;
  font-size: 0.7rem;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(0, 212, 170, 0.15);
  color: var(--accent2);
  margin-left: 6px;
  vertical-align: middle;
}
