:root {
  --bg: #0a0a0b;
  --surface: #131316;
  --surface-2: #1c1c21;
  --surface-3: #25252c;
  --border: #26262d;
  --border-strong: #353540;
  --text: #ebebef;
  --text-dim: #b8b8c0;
  --muted: #8a8a96;
  --accent: #5b8cff;
  --accent-hover: #7ba3ff;
  --accent-soft: rgba(91, 140, 255, 0.12);
  --danger: #e5484d;
  --danger-soft: rgba(229, 72, 77, 0.12);
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(0,0,0,0.5), 0 12px 32px rgba(0,0,0,0.35);
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto,
               "Helvetica Neue", Arial, sans-serif;
  font-feature-settings: "cv11", "ss01";
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

/* ---------- Auth pages ---------- */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 36px 32px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.auth-logo { font-size: 36px; text-align: center; margin-bottom: 4px; }
.auth-title { margin: 0; font-size: 22px; font-weight: 600; text-align: center; letter-spacing: -0.01em; }
.auth-sub { margin: 0 0 12px; color: var(--muted); text-align: center; font-size: 13px; }
.auth-foot { margin: 8px 0 0; color: var(--muted); font-size: 12px; text-align: center; line-height: 1.5; }
.auth-card label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.auth-card input {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  text-transform: none;
  letter-spacing: normal;
  font-weight: 400;
}
.auth-card input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.alert {
  background: var(--danger-soft);
  border: 1px solid rgba(229, 72, 77, 0.3);
  color: var(--danger);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
}

/* ---------- Buttons ---------- */
.btn {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.05s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.btn:hover:not(:disabled) {
  background: var(--surface-3);
  border-color: var(--border-strong);
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}
.btn.primary:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}
.btn.danger {
  background: transparent;
  border-color: rgba(229, 72, 77, 0.4);
  color: var(--danger);
}
.btn.danger:hover:not(:disabled) {
  background: var(--danger-soft);
  border-color: var(--danger);
}
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover:not(:disabled) { background: var(--surface-2); color: var(--text); border-color: transparent; }

/* ---------- Top bar ---------- */
.topbar {
  border-bottom: 1px solid var(--border);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(8px);
}
.brand {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  display: flex;
  gap: 8px;
}
.topbar-actions { display: flex; gap: 12px; align-items: center; }
.user-pill {
  font-size: 13px;
  color: var(--muted);
  padding: 4px 10px;
  background: var(--surface-2);
  border-radius: 12px;
  border: 1px solid var(--border);
}

/* ---------- Container ---------- */
.container { max-width: 1100px; margin: 0 auto; padding: 24px; }

/* ---------- Breadcrumbs ---------- */
.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  font-size: 14px;
  flex-wrap: wrap;
}
.crumb { color: var(--muted); transition: color 0.15s; }
.crumb:hover { color: var(--text); }
.crumb.current { color: var(--text); font-weight: 500; }
.crumb-sep { color: var(--border-strong); user-select: none; }

/* ---------- Toolbar ---------- */
.toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.spacer { flex: 1; }
.storage-info { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---------- File list ---------- */
.filelist {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.filelist-head, .filerow {
  display: grid;
  grid-template-columns: 36px 1fr 110px 150px 90px;
  gap: 12px;
  align-items: center;
  padding: 10px 16px;
}
.filelist-head {
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.filerow {
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}
.filerow:last-child { border-bottom: none; }
.filerow:hover { background: var(--surface-2); }
.filerow.selected { background: var(--accent-soft); }

.col-check input[type="checkbox"] {
  accent-color: var(--accent);
  cursor: pointer;
}

.col-name { min-width: 0; overflow: hidden; }
.filename {
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
  font-weight: 450;
}
.filename-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.filename:hover { color: var(--accent); }
.filename.folder { font-weight: 500; }
.icon { font-size: 16px; flex-shrink: 0; opacity: 0.95; }

.col-size, .col-date {
  color: var(--muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.col-actions { display: flex; gap: 2px; justify-content: flex-end; }
.row-action {
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 5px;
  font-size: 14px;
  font-family: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.1s, color 0.1s;
}
.row-action:hover {
  background: var(--surface-3);
  color: var(--text);
}

/* ---------- Empty state ---------- */
.empty {
  text-align: center;
  padding: 80px 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--muted);
}
.empty-icon { font-size: 40px; margin-bottom: 12px; opacity: 0.7; }
.empty p { margin: 4px 0; }
.muted { color: var(--muted); }

/* ---------- Dropzone ---------- */
.dropzone {
  display: none;
  border: 2px dashed var(--accent);
  background: var(--accent-soft);
  border-radius: var(--radius);
  padding: 48px;
  margin-bottom: 16px;
  text-align: center;
  pointer-events: none;
}
.dropzone.active { display: block; }
.dropzone-inner {
  color: var(--accent);
  font-weight: 500;
  font-size: 15px;
}
.dropzone-icon { font-size: 32px; margin-bottom: 8px; }

/* ---------- Upload overlay ---------- */
.upload-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(4px);
}
.upload-overlay.hidden { display: none; }
.upload-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 28px;
  min-width: 340px;
  box-shadow: var(--shadow);
}
.upload-card h3 { margin: 0 0 16px; font-size: 15px; font-weight: 600; }
.progress {
  background: var(--surface-2);
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
}
.progress-bar {
  background: var(--accent);
  height: 100%;
  width: 0;
  transition: width 0.2s;
}
.progress-text {
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* ---------- Mobile ---------- */
@media (max-width: 720px) {
  .container { padding: 16px; }
  .topbar { padding: 12px 16px; }
  .filelist-head, .filerow {
    grid-template-columns: 32px 1fr auto;
    gap: 8px;
    padding: 12px;
  }
  .col-size, .col-date { display: none; }
  .auth-card { padding: 28px 24px; }
  .upload-card { min-width: 0; width: calc(100vw - 48px); max-width: 360px; }
}
