* { margin:0; padding:0; box-sizing:border-box; }
:root {
  --primary: #3b82f6;
  --primary-dark: #2563eb;
  --primary-light: #dbeafe;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --bg: #f8fafc;
  --card: #ffffff;
  --text: #0f172a;
  --text-secondary: #64748b;
  --border: #e2e8f0;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.05), 0 2px 4px rgba(0,0,0,0.03);
}
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}
.container {
  max-width: 860px;
  margin: 0 auto;
  padding: 24px 16px 60px;
}
.hidden { display: none !important; }
.mono { font-family: SFMono-Regular, Consolas, monospace; font-size: 12px; word-break: break-all; }

/* Header */
.header { text-align: center; margin-bottom: 28px; }
.logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 26px;
  font-weight: 700;
  color: var(--primary);
}
.subtitle { color: var(--text-secondary); font-size: 14px; margin-top: 4px; }

/* Card */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 20px;
  border: 1px solid var(--border);
}

/* Upload Drop Zone */
.drop-zone {
  border: 2px dashed #cbd5e1;
  border-radius: 12px;
  padding: 48px 20px;
  text-align: center;
  transition: all 0.2s ease;
  cursor: pointer;
  background: #fafbfc;
}
.drop-zone:hover,
.drop-zone.dragover {
  border-color: var(--primary);
  background: var(--primary-light);
}
.drop-icon {
  color: #94a3b8;
  margin-bottom: 12px;
}
.drop-zone:hover .drop-icon,
.drop-zone.dragover .drop-icon { color: var(--primary); }
.drop-title { font-size: 16px; font-weight: 500; }
.clickable { color: var(--primary); text-decoration: underline; }
.drop-hint { font-size: 13px; color: var(--text-secondary); margin-top: 6px; }

/* Config */
.config { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--border); }
.file-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  background: var(--bg);
  border-radius: 8px;
  margin-bottom: 18px;
  gap: 12px;
}
.file-name { font-weight: 500; word-break: break-all; flex: 1; }
.file-size { color: var(--text-secondary); font-size: 14px; white-space: nowrap; }

.retention-group { margin-bottom: 20px; }
.retention-label { display: block; font-size: 14px; margin-bottom: 8px; color: var(--text-secondary); }
.retention-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.retention-option {
  position: relative;
  padding: 10px;
  border: 2px solid var(--border);
  border-radius: 8px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
  font-size: 14px;
}
.retention-option input { position: absolute; opacity: 0; pointer-events: none; }
.retention-option:hover { border-color: #94a3b8; }
.retention-option.active { border-color: var(--primary); background: var(--primary-light); color: var(--primary-dark); font-weight: 600; }

/* Buttons */
.action-row {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:disabled { background: #93c5fd; cursor: not-allowed; }
.btn-ghost { background: var(--bg); color: var(--text-secondary); border: 1px solid var(--border); }
.btn-ghost:hover { background: #e2e8f0; color: var(--text); }
.btn-danger { background: #fef2f2; color: var(--danger); border: 1px solid #fecaca; }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 13px; }

/* Progress */
.progress-wrap { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--border); }
.progress-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
  font-size: 14px;
}
.progress-file { font-weight: 500; word-break: break-all; flex: 1; padding-right: 12px; }
.progress-percent { font-weight: 600; color: var(--primary); white-space: nowrap; }
.progress-bar {
  width: 100%;
  height: 10px;
  background: var(--bg);
  border-radius: 999px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #60a5fa);
  border-radius: 999px;
  width: 0%;
  transition: width 0.3s ease;
}
.progress-detail {
  margin-top: 10px;
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-secondary);
}
.chunks-info { font-variant-numeric: tabular-nums; }
.msg { margin-top: 12px; padding: 10px 12px; border-radius: 8px; font-size: 13px; }
.msg.info { background: var(--primary-light); color: var(--primary-dark); }
.msg.success { background: #d1fae5; color: #065f46; }
.msg.error { background: #fee2e2; color: #991b1b; }

/* Success */
.success-card { text-align: center; }
.success-icon { margin-bottom: 12px; }
.success-card h3 { font-size: 20px; color: var(--success); margin-bottom: 18px; }
.success-detail { text-align: left; background: var(--bg); padding: 14px; border-radius: 8px; margin-bottom: 16px; }
.detail-row { padding: 4px 0; display: flex; font-size: 14px; }
.detail-row .label { color: var(--text-secondary); width: 90px; flex-shrink: 0; }

/* File list */
.list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.list-header h2 { font-size: 18px; }
.file-list { display: flex; flex-direction: column; gap: 10px; }
.empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-secondary);
}
.empty p { margin-top: 10px; font-size: 14px; }

.file-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  transition: all 0.15s;
}
.file-item:hover { border-color: #cbd5e1; box-shadow: var(--shadow-md); }
.file-item-main {
  display: flex;
  align-items: center;
  gap: 12px;
}
.file-icon {
  width: 40px; height: 40px;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--primary-light);
  color: var(--primary-dark);
  border-radius: 8px;
}
.file-meta { flex: 1; min-width: 0; }
.file-meta-name {
  font-weight: 500;
  word-break: break-all;
  margin-bottom: 4px;
}
.file-meta-info {
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
}
.badge-success { background: #d1fae5; color: #065f46; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: #991b1b; }

.file-actions { display: flex; gap: 6px; flex-shrink: 0; }
.file-actions .btn-sm { padding: 6px 10px; }

.footer {
  text-align: center;
  color: var(--text-secondary);
  font-size: 12px;
  margin-top: 24px;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--text);
  color: #fff;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  opacity: 0;
  transition: all 0.3s;
  z-index: 1000;
  max-width: 90%;
}
.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}
.toast.error { background: var(--danger); }
.toast.success { background: var(--success); }

/* Responsive */
@media (max-width: 600px) {
  .container { padding: 16px 12px 48px; }
  .card { padding: 18px; }
  .drop-zone { padding: 32px 14px; }
  .retention-options { gap: 6px; }
  .retention-option { padding: 8px 4px; font-size: 13px; }
  .file-item-main { flex-wrap: wrap; }
  .file-actions { width: 100%; justify-content: flex-end; }
}
