:root {
  --bg: #f7f7f8;
  --surface: #ffffff;
  --border: #e5e5e7;
  --text: #18181b;
  --muted: #71717a;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --danger: #dc2626;
  --success: #16a34a;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

header h1 {
  font-size: 18px;
  margin: 0;
  font-weight: 600;
}
header .user {
  color: var(--muted);
  font-size: 13px;
  margin-right: 12px;
}
header .user-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

main {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px;
}

#breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  margin-bottom: 16px;
  font-size: 14px;
}

#breadcrumb a {
  color: var(--accent);
  text-decoration: none;
  padding: 4px 8px;
  border-radius: 4px;
}
#breadcrumb a:hover {
  background: var(--surface);
}
#breadcrumb .sep {
  color: var(--muted);
}

.toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

button {
  padding: 8px 16px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s;
}
button:hover:not(:disabled) {
  background: var(--accent-hover);
}
button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
button.secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}
button.secondary:hover {
  background: var(--bg);
}
button.danger {
  background: var(--danger);
}
button.small {
  padding: 4px 10px;
  font-size: 13px;
}

#dropzone {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  min-height: 200px;
  transition: border-color 0.15s;
}
#dropzone.dragover {
  border-color: var(--accent);
}

.file-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.file-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.file-list li:last-child {
  border-bottom: none;
}
.file-list li:hover {
  background: var(--bg);
}

.file-icon {
  font-size: 20px;
  width: 24px;
  text-align: center;
}

.file-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-name.folder {
  cursor: pointer;
  color: var(--accent);
  font-weight: 500;
}
.file-name.folder:hover {
  text-decoration: underline;
}

.file-meta {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.file-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.1s;
}
.file-list li:hover .file-actions {
  opacity: 1;
}

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

#uploadProgress {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  min-width: 260px;
  z-index: 100;
}

#uploadProgress .bar {
  height: 6px;
  background: var(--bg);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 6px;
}

#uploadProgress .bar-inner {
  height: 100%;
  background: var(--accent);
  width: 0;
  transition: width 0.15s;
}

#uploadProgress .label {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
}

.auth-container {
  max-width: 400px;
  margin: 80px auto;
  background: var(--surface);
  padding: 32px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.auth-container h1 {
  margin: 0 0 24px;
  font-size: 24px;
  text-align: center;
}

.form-group {
  margin-bottom: 16px;
}
.form-group label {
  display: block;
  margin-bottom: 4px;
  font-weight: 500;
}
.form-group input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: inherit;
}
.form-group input:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}

.auth-container button {
  width: 100%;
  padding: 12px;
  margin-top: 8px;
}
.auth-container .switch {
  text-align: center;
  margin-top: 16px;
  color: var(--muted);
  font-size: 13px;
}
.auth-container .switch a {
  color: var(--accent);
  text-decoration: none;
}

.error-msg {
  background: #fef2f2;
  color: var(--danger);
  padding: 10px 12px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 13px;
  border: 1px solid #fecaca;
  display: none;
}
.error-msg.visible {
  display: block;
}

.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: #18181b;
  color: white;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-size: 13px;
  z-index: 200;
  animation: slideUp 0.2s ease;
}
.toast.error {
  background: var(--danger);
}
.toast.success {
  background: var(--success);
}

@keyframes slideUp {
  from {
    transform: translateX(-50%) translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
  }
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}
.modal {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 24px;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}
.modal h2 {
  margin: 0 0 16px;
  font-size: 18px;
}
.modal input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  margin-bottom: 12px;
  font-family: inherit;
}
.modal .modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
.modal p {
  color: var(--muted);
  margin: 0 0 12px;
  font-size: 13px;
}
.modal code {
  background: var(--bg);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
  word-break: break-all;
}
