*, *::before, *::after { box-sizing: border-box; }

:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --danger: #dc2626;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-400: #9ca3af;
  --gray-600: #4b5563;
  --gray-900: #111827;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  margin: 0;
  background: var(--gray-50);
  color: var(--gray-900);
  font-size: 14px;
}

header {
  background: white;
  border-bottom: 1px solid var(--gray-200);
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
}

header h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.container {
  max-width: 960px;
  margin: 24px auto;
  padding: 0 16px;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

#breadcrumb {
  flex: 1;
  font-size: 13px;
  color: var(--gray-600);
}

.crumb {
  cursor: pointer;
  color: var(--primary);
}
.crumb:hover { text-decoration: underline; }
.sep { color: var(--gray-400); margin: 0 4px; }

.btn {
  padding: 6px 14px;
  border-radius: 6px;
  border: none;
  font-size: 13px;
  cursor: pointer;
  font-weight: 500;
  transition: background 0.15s;
  white-space: nowrap;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary {
  background: white;
  color: var(--gray-600);
  border: 1px solid var(--gray-200);
}
.btn-secondary:hover { background: var(--gray-50); }

#upload-panel {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
}

.upload-controls {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

#password {
  padding: 6px 10px;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  font-size: 13px;
  outline: none;
  width: 160px;
}
#password:focus { border-color: var(--primary); box-shadow: 0 0 0 2px #dbeafe; }

.file-btn-label {
  display: inline-block;
  padding: 6px 14px;
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  font-weight: 500;
  color: var(--gray-600);
  transition: background 0.15s;
  user-select: none;
}
.file-btn-label:hover { background: var(--gray-50); }
.file-btn-label input { display: none; }

#drop-zone {
  border: 2px dashed var(--gray-200);
  border-radius: 8px;
  padding: 24px;
  text-align: center;
  color: var(--gray-400);
  font-size: 13px;
  transition: all 0.15s;
}
#drop-zone.dragover {
  border-color: var(--primary);
  background: #eff6ff;
  color: var(--primary);
}

#upload-queue {
  margin-top: 12px;
  max-height: 180px;
  overflow-y: auto;
}

.queue-item {
  padding: 5px 8px;
  font-size: 12px;
  border-radius: 4px;
  margin-bottom: 3px;
  background: var(--gray-50);
  word-break: break-all;
}
.queue-item.done { background: #f0fdf4; color: #16a34a; }
.queue-item.error { background: #fef2f2; color: var(--danger); }
.queue-item.uploading { color: var(--gray-600); }

.card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  overflow: hidden;
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead th {
  text-align: left;
  padding: 10px 16px;
  font-size: 11px;
  font-weight: 600;
  color: var(--gray-400);
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

tbody tr {
  border-bottom: 1px solid var(--gray-100);
  transition: background 0.1s;
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--gray-50); }

tbody td {
  padding: 10px 16px;
  vertical-align: middle;
}
tbody td:nth-child(2),
tbody td:nth-child(3) {
  color: var(--gray-400);
  font-size: 12px;
  white-space: nowrap;
}
tbody td:last-child { min-width: 140px; text-align: right; }

.dir-link {
  cursor: pointer;
  color: var(--gray-900);
  font-weight: 500;
}
.dir-link:hover { color: var(--primary); }

.file-link {
  text-decoration: none;
  color: var(--gray-900);
}
.file-link:hover { color: var(--primary); }

.btn-delete, .btn-rename {
  padding: 4px 10px;
  border: 1px solid var(--gray-200);
  border-radius: 4px;
  background: white;
  font-size: 12px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s;
}
.btn-delete { color: var(--danger); }
.btn-rename { color: var(--primary); }
tr:hover .btn-delete, tr:hover .btn-rename { opacity: 1; }
.btn-delete:hover { background: #fef2f2; border-color: #fecaca; }
.btn-rename:hover { background: #eff6ff; border-color: #bfdbfe; }

/* ── 密码弹窗 ── */
.auth-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  backdrop-filter: blur(4px);
}
.auth-modal.hidden { display: none; }
.auth-box {
  background: white;
  border-radius: 12px;
  padding: 32px 28px;
  width: 300px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
}
.auth-close {
  position: absolute;
  top: 10px;
  right: 12px;
  background: none;
  border: none;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  color: #9ca3af;
  padding: 4px;
}
.auth-close:hover { color: #374151; }
.auth-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--gray-900);
  text-align: center;
}
.auth-input {
  padding: 10px 14px;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  width: 100%;
  box-sizing: border-box;
}
.auth-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px #dbeafe; }
.auth-btn {
  padding: 10px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}
.auth-btn:hover { background: var(--primary-hover); }
.auth-error {
  color: var(--danger);
  font-size: 13px;
  text-align: center;
  margin: 0;
}

#empty-hint {
  text-align: center;
  color: var(--gray-400);
  padding: 56px 16px;
  font-size: 13px;
}

#error-msg {
  position: fixed;
  top: 16px;
  right: 16px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: var(--danger);
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 13px;
  max-width: 320px;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.hidden { display: none !important; }
