:root {
  --bg0: #0f1412;
  --bg1: #17201c;
  --bg2: #1e2a24;
  --panel: rgba(232, 240, 234, 0.04);
  --line: rgba(232, 240, 234, 0.12);
  --text: #e8f0ea;
  --muted: #8fa396;
  --accent: #3dba8a;
  --accent-dim: rgba(61, 186, 138, 0.16);
  --danger: #e86a5c;
  --warn: #e0b35a;
  --radius: 12px;
  --font: "DM Sans", system-ui, sans-serif;
  --display: "Instrument Serif", Georgia, serif;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1000px 500px at 10% -10%, rgba(61, 186, 138, 0.18), transparent 55%),
    radial-gradient(800px 400px at 90% 0%, rgba(90, 140, 120, 0.12), transparent 50%),
    linear-gradient(165deg, var(--bg0), var(--bg1) 45%, #121916);
  background-attachment: fixed;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select { font: inherit; }
button { cursor: pointer; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  border-radius: 10px;
  padding: 0.55rem 0.95rem;
  transition: background .15s, border-color .15s, transform .12s;
}
.btn:hover { background: rgba(232, 240, 234, 0.08); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary {
  background: var(--accent);
  border-color: transparent;
  color: #062216;
  font-weight: 600;
}
.btn-primary:hover { filter: brightness(1.05); background: var(--accent); }
.btn-danger { border-color: rgba(232, 106, 92, 0.45); color: #ffc7c1; }
.btn-ghost { background: transparent; }
.btn-block { width: 100%; }
.btn-sm { padding: 0.35rem 0.65rem; font-size: 0.85rem; border-radius: 8px; }

/* ----- login ----- */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; }
.login-shell { width: min(420px, 100%); }
.login-panel {
  background: rgba(15, 20, 18, 0.72);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 2rem 1.75rem 1.5rem;
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
  animation: rise .45s ease both;
}
.brand-mark {
  margin: 0;
  font-family: var(--display);
  font-size: 1.75rem;
  letter-spacing: 0.02em;
  color: var(--accent);
}
.login-panel h1 {
  margin: 0.35rem 0 0;
  font-size: 1.55rem;
  font-weight: 600;
}
.login-sub { margin: 0.4rem 0 1.4rem; color: var(--muted); font-size: 0.95rem; }
.field { display: grid; gap: 0.4rem; margin-bottom: 1rem; }
.field span { color: var(--muted); font-size: 0.85rem; }
.field input {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.25);
  color: var(--text);
  border-radius: 10px;
  padding: 0.7rem 0.85rem;
  outline: none;
}
.field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
.form-msg { color: var(--danger); font-size: 0.9rem; margin: 0.75rem 0 0; }
.login-ver { margin: 1.25rem 0 0; color: var(--muted); font-size: 0.75rem; text-align: center; }

/* ----- shells ----- */
.shell { min-height: 100vh; display: grid; grid-template-rows: auto 1fr; }
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1.25rem;
  border-bottom: 1px solid var(--line);
  background: rgba(15, 20, 18, 0.65);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand h1 {
  margin: 0;
  font-family: var(--display);
  font-size: 1.55rem;
  font-weight: 400;
  letter-spacing: 0.01em;
}
.brand span { color: var(--muted); font-size: 0.82rem; }
.topbar-actions { display: flex; flex-wrap: wrap; gap: 0.45rem; }

.main {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: 0;
}
@media (max-width: 860px) {
  .main { grid-template-columns: 1fr; }
  .side { border-right: 0; border-bottom: 1px solid var(--line); }
}

.side {
  border-right: 1px solid var(--line);
  padding: 1rem;
  background: rgba(0, 0, 0, 0.15);
}
.side h2 {
  margin: 0 0 0.75rem;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 600;
}
.nav-btn {
  width: 100%;
  text-align: left;
  margin-bottom: 0.35rem;
}
.nav-btn.active {
  background: var(--accent-dim);
  border-color: rgba(61, 186, 138, 0.4);
  color: #b8f0d4;
}

.content { padding: 1rem 1.25rem 2rem; min-width: 0; }
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.9rem;
}
.crumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  align-items: center;
  color: var(--muted);
  font-size: 0.9rem;
  margin-right: auto;
}
.crumbs button {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0.15rem 0.3rem;
  border-radius: 6px;
}
.crumbs button:hover { color: var(--text); background: var(--panel); }
.crumbs .sep { opacity: 0.4; }

.panel {
  border: 1px solid var(--line);
  background: rgba(15, 20, 18, 0.45);
  border-radius: var(--radius);
  overflow: hidden;
}

.file-table { width: 100%; border-collapse: collapse; }
.file-table th, .file-table td {
  padding: 0.7rem 0.85rem;
  text-align: left;
  border-bottom: 1px solid var(--line);
  font-size: 0.92rem;
}
.file-table th {
  color: var(--muted);
  font-weight: 500;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: rgba(0, 0, 0, 0.2);
}
.file-table tr:last-child td { border-bottom: 0; }
.file-table tr:hover td { background: rgba(232, 240, 234, 0.03); }
.file-table .name-cell {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
}
.file-table .name-cell button.linkish,
.file-table .name-cell .linkish {
  border: 0;
  background: none;
  color: var(--text);
  padding: 0;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.file-table .name-cell button.linkish:hover { color: var(--accent); text-decoration: underline; }
.icon-pill {
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
  background: var(--bg2);
  color: var(--muted);
}
.icon-pill.folder { color: #e0b35a; background: rgba(224, 179, 90, 0.12); }
.icon-pill.image { color: #7ec8ff; background: rgba(126, 200, 255, 0.12); }
.icon-pill.video { color: #c79bff; background: rgba(199, 155, 255, 0.12); }
.icon-pill.audio { color: #3dba8a; background: var(--accent-dim); }
.icon-pill.pdf { color: #e86a5c; background: rgba(232, 106, 92, 0.12); }
.row-actions { display: flex; flex-wrap: wrap; gap: 0.3rem; }

.empty {
  padding: 3rem 1rem;
  text-align: center;
  color: var(--muted);
}

.toast {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 80;
  background: #102019;
  border: 1px solid var(--line);
  color: var(--text);
  padding: 0.7rem 1rem;
  border-radius: 10px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: .2s ease;
  max-width: min(360px, calc(100vw - 2rem));
}
.toast.show { opacity: 1; transform: none; }
.toast.error { border-color: rgba(232, 106, 92, 0.5); color: #ffc7c1; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: grid;
  place-items: center;
  padding: 1rem;
  z-index: 60;
  animation: fade .15s ease;
}
.modal {
  width: min(960px, 100%);
  max-height: min(88vh, 900px);
  overflow: auto;
  background: #121a16;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  animation: rise .2s ease;
}
.modal.sm { width: min(420px, 100%); }
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: #121a16;
  z-index: 1;
}
.modal-head h3 { margin: 0; font-size: 1.05rem; font-weight: 600; }
.modal-body { padding: 1rem; }
.modal-body video,
.modal-body img,
.modal-body audio,
.modal-body iframe {
  width: 100%;
  max-height: 70vh;
  border-radius: 10px;
  background: #000;
}
.modal-body img { object-fit: contain; background: #0a0f0c; }
.modal-body pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.85rem;
  line-height: 1.5;
  color: #d5e4da;
  max-height: 65vh;
  overflow: auto;
}
.hint { color: var(--muted); font-size: 0.88rem; margin: 0 0 0.75rem; }

.upload-zone {
  border: 1.5px dashed rgba(61, 186, 138, 0.45);
  background: var(--accent-dim);
  border-radius: 12px;
  padding: 1.25rem;
  text-align: center;
  color: var(--muted);
  margin-bottom: 0.9rem;
  transition: border-color .15s, background .15s;
}
.upload-zone.drag { border-color: var(--accent); background: rgba(61, 186, 138, 0.22); color: var(--text); }
.upload-zone strong { color: var(--text); }
.progress {
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 99px;
  overflow: hidden;
  margin-top: 0.6rem;
}
.progress > i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width .15s;
}

.share-list { display: grid; gap: 0.65rem; }
.share-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.85rem 1rem;
  background: var(--panel);
  display: grid;
  gap: 0.35rem;
}
.share-card .meta { color: var(--muted); font-size: 0.85rem; }
.share-card .url { font-size: 0.88rem; word-break: break-all; }

.share-home {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
}
.share-hero {
  padding: 1.5rem 1.25rem 0.5rem;
}
.share-hero h1 {
  margin: 0.2rem 0;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(1.8rem, 4vw, 2.4rem);
}
.share-hero p { margin: 0; color: var(--muted); }

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
@keyframes fade {
  from { opacity: 0; }
  to { opacity: 1; }
}
