:root {
  --bg: #0f1115;
  --surface: #171a21;
  --surface-2: #1f232c;
  --border: #2a2f3a;
  --text: #e8eaed;
  --text-muted: #8b909c;
  --accent: #5b8def;
  --accent-hover: #4a7ce0;
  --danger: #e85d5d;
  --danger-hover: #d44747;
  --success: #4caf7d;
  --radius: 12px;
  font-size: 16px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ===== Auth page ===== */
.auth-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 360px;
  text-align: center;
  box-shadow: 0 10px 40px rgba(0,0,0,0.35);
}

.auth-card .logo { font-size: 2.5rem; margin-bottom: 0.5rem; }
.auth-card h1 { margin: 0 0 0.25rem; font-size: 1.4rem; }
.auth-card .subtitle { color: var(--text-muted); margin: 0 0 1.5rem; font-size: 0.9rem; }

.auth-card form { display: flex; flex-direction: column; gap: 0.75rem; }

.auth-card input[type="password"] {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.8rem 1rem;
  color: var(--text);
  font-size: 1rem;
  width: 100%;
  outline: none;
}
.auth-card input[type="password"]:focus { border-color: var(--accent); }

.auth-card button {
  background: var(--accent);
  border: none;
  border-radius: 8px;
  color: #fff;
  padding: 0.8rem 1rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}
.auth-card button:hover { background: var(--accent-hover); }

.alert {
  background: rgba(232, 93, 93, 0.12);
  border: 1px solid rgba(232, 93, 93, 0.4);
  color: #f0a3a3;
  padding: 0.6rem 0.8rem;
  border-radius: 8px;
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

/* ===== App layout ===== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { font-weight: 700; font-size: 1.1rem; }
.logout-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  border: 1px solid var(--border);
  padding: 0.4rem 0.8rem;
  border-radius: 8px;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.logout-link:hover { color: var(--text); border-color: var(--accent); }

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* ===== Upload card ===== */
.upload-card {
  background: var(--surface);
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 2.5rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.upload-card.dragover {
  border-color: var(--accent);
  background: rgba(91, 141, 239, 0.06);
}
.upload-icon { font-size: 2rem; margin-bottom: 0.5rem; }
.upload-text { margin: 0 0 0.25rem; font-size: 1rem; }
.browse-link { color: var(--accent); text-decoration: underline; }
.upload-hint { margin: 0; color: var(--text-muted); font-size: 0.8rem; }

.progress-wrap {
  margin-top: 1rem;
  height: 8px;
  background: var(--surface-2);
  border-radius: 4px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.15s ease;
}

.upload-status {
  margin-top: 0.75rem;
  font-size: 0.85rem;
  min-height: 1.2em;
}
.upload-status.error { color: var(--danger); }
.upload-status.success { color: var(--success); }

/* ===== History ===== */
.history-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}
.history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.history-header h2 { margin: 0; font-size: 1.05rem; }
.refresh-btn {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 8px;
  width: 32px;
  height: 32px;
  cursor: pointer;
  font-size: 1rem;
  transition: color 0.15s ease, transform 0.15s ease;
}
.refresh-btn:hover { color: var(--text); transform: rotate(90deg); }

.file-list { display: flex; flex-direction: column; gap: 0.6rem; }

.empty-state { color: var(--text-muted); font-size: 0.9rem; text-align: center; padding: 1rem 0; }

.file-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem 0.9rem;
}
.file-icon { font-size: 1.4rem; flex-shrink: 0; }
.file-info { flex: 1; min-width: 0; }
.file-name {
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.file-meta { font-size: 0.75rem; color: var(--text-muted); }

.file-actions { display: flex; gap: 0.4rem; flex-shrink: 0; }

.icon-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 8px;
  width: 34px;
  height: 34px;
  cursor: pointer;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.icon-btn:hover { border-color: var(--accent); }
.icon-btn.danger:hover { border-color: var(--danger); color: var(--danger); }

/* ===== Toast ===== */
.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.7rem 1.2rem;
  border-radius: 10px;
  font-size: 0.85rem;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  z-index: 50;
}
.toast.success { border-color: var(--success); }
.toast.error { border-color: var(--danger); }

/* ===== Responsive ===== */
@media (max-width: 480px) {
  .container { padding: 1rem; }
  .upload-card { padding: 1.75rem 1rem; }
  .file-name { font-size: 0.85rem; }
}
