:root {
  --bg: #0f1419;
  --surface: #1a2332;
  --surface2: #243044;
  --text: #e8edf4;
  --muted: #8b9cb3;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --success: #22c55e;
  --danger: #ef4444;
  --border: #2d3a4f;
  --radius: 10px;
  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  background: radial-gradient(ellipse 120% 80% at 50% -20%, #1e3a5f 0%, var(--bg) 55%);
  color: var(--text);
  line-height: 1.5;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.wrap {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 20px 48px;
}

header.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.logo {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.logo span {
  color: var(--muted);
  font-weight: 400;
  font-size: 0.9rem;
  margin-left: 8px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-bottom: 16px;
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 16px;
}

.breadcrumb button {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  padding: 0;
  font: inherit;
}

.breadcrumb button:hover {
  text-decoration: underline;
}

.breadcrumb .sep {
  opacity: 0.4;
}

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

.list li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 10px;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}

.list li:last-child {
  border-bottom: none;
}

.list li:hover {
  background: var(--surface2);
  border-radius: 6px;
}

.list .icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.list .icon.dir {
  background: #1e3a5f;
}

.list .icon.file {
  background: #1a3d2e;
}

.list .meta {
  flex: 1;
  min-width: 0;
}

.list .name {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.list .sub {
  font-size: 0.8rem;
  color: var(--muted);
}

.list .actions {
  display: flex;
  gap: 8px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.btn:hover {
  background: #2d4058;
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-danger {
  border-color: #7f1d1d;
  color: #fca5a5;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 0.82rem;
}

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

.lock-panel {
  text-align: center;
  padding: 40px 24px;
}

.lock-panel h2 {
  margin: 0 0 8px;
}

.lock-panel p {
  color: var(--muted);
  margin: 0 0 20px;
}

.field {
  margin-bottom: 14px;
  text-align: left;
}

.field label {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 6px;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font: inherit;
}

.field textarea {
  min-height: 72px;
  resize: vertical;
}

.badge {
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 999px;
  background: #422006;
  color: #fcd34d;
  border: 1px solid #78350f;
}

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 12px 18px;
  border-radius: 8px;
  background: var(--surface2);
  border: 1px solid var(--border);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  z-index: 100;
  animation: fadeIn 0.2s;
}

.toast.err {
  border-color: #7f1d1d;
  color: #fecaca;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

.admin-grid {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 20px;
}

@media (max-width: 768px) {
  .admin-grid {
    grid-template-columns: 1fr;
  }
}

.tree-item {
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tree-item:hover,
.tree-item.active {
  background: var(--surface2);
}

.tree-item.active {
  outline: 1px solid var(--accent);
}

.login-box {
  max-width: 380px;
  margin: 80px auto;
}

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

.hidden {
  display: none !important;
}

.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  color: var(--muted);
  margin-bottom: 16px;
}

.upload-zone input[type='file'] {
  margin-top: 12px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 20px;
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  width: 100%;
  max-width: 420px;
}

.modal h3 {
  margin: 0 0 16px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}