/* ============================================================
   Secure File Server — "Vault" theme
   Black + red, restrained gradients, system fonts (no CDN deps)
   ============================================================ */

:root {
  --yt-ticker-h: 0px;
  --card-size: 150px;
  --bg: #08080a;
  --bg-panel: #131316;
  --bg-panel-2: #1a1a1f;
  --line: #2a2a30;
  --red: #ff2440;
  --red-deep: #7a0d1c;
  --red-glow: rgba(255, 36, 64, 0.35);
  --text: #f2f1f0;
  --text-dim: #a3a2a8;
  --text-faint: #6b6a70;
  --ok: #33c17a;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --radius: 10px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--red-glow); color: #fff; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--bg-panel-2); border-radius: 8px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--red-deep); }

a { color: inherit; }

button {
  font-family: inherit;
  cursor: pointer;
}
:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
}

/* ---------------- Login page ---------------- */
.login-wrap {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(650px 500px at 20% 15%, rgba(122, 13, 28, 0.35), transparent 60%),
    radial-gradient(700px 550px at 85% 85%, rgba(255, 36, 64, 0.18), transparent 60%),
    var(--bg);
}

.grid-lines {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 36, 64, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 36, 64, 0.05) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(circle at 50% 40%, black, transparent 75%);
  pointer-events: none;
}

.login-card {
  position: relative;
  width: 380px;
  max-width: calc(100vw - 40px);
  padding: 36px 34px 30px;
  background: linear-gradient(180deg, var(--bg-panel), var(--bg-panel-2));
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 0 0 1px rgba(255,36,64,0.05), 0 30px 80px -20px rgba(0,0,0,0.8), 0 0 60px -20px var(--red-glow);
}

.login-mark {
  width: 46px;
  height: 46px;
  border-radius: 10px;
  background: linear-gradient(155deg, var(--red) 0%, var(--red-deep) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
  box-shadow: 0 8px 24px -6px var(--red-glow);
}
.login-mark svg { width: 24px; height: 24px; }

.login-card h1 {
  font-size: 21px;
  margin: 0 0 4px;
  letter-spacing: 0.2px;
}
.login-card p.sub {
  margin: 0 0 26px;
  color: var(--text-dim);
  font-size: 13.5px;
}

.field {
  margin-bottom: 16px;
}
.field label {
  display: block;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  margin-bottom: 7px;
}
.field input {
  width: 100%;
  padding: 11px 13px;
  background: #0d0d10;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font-size: 14.5px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field input:focus {
  outline: none;
  border-color: var(--red);
  box-shadow: 0 0 0 3px var(--red-glow);
}

.btn-primary {
  width: 100%;
  padding: 12px 14px;
  border: none;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--red) 0%, var(--red-deep) 100%);
  color: #fff;
  font-weight: 600;
  font-size: 14.5px;
  letter-spacing: 0.02em;
  margin-top: 6px;
  transition: filter .15s ease, transform .1s ease;
}
.btn-primary:hover { filter: brightness(1.12); }
.btn-primary:active { transform: translateY(1px); }
.btn-primary:disabled { opacity: 0.55; cursor: default; filter: none; }

.error-banner {
  display: none;
  background: rgba(255, 36, 64, 0.1);
  border: 1px solid rgba(255, 36, 64, 0.35);
  color: #ff8a97;
  font-size: 13px;
  padding: 9px 11px;
  border-radius: 7px;
  margin-bottom: 16px;
}
.error-banner.show { display: block; }

/* ---------------- Dashboard ---------------- */
.dashboard-shell {
  display: flex;
  flex-direction: column;
  height: 100%;
}
.app {
  display: grid;
  grid-template-columns: 230px 1fr;
  flex: 1;
  min-height: 0;
}

/* ---------------- YouTube stats ticker ---------------- */
.yt-ticker {
  flex-shrink: 0;
  height: 32px;
  overflow: hidden;
  white-space: nowrap;
  background: linear-gradient(90deg, var(--red-deep), var(--red));
  border-bottom: 1px solid var(--line);
}
.yt-ticker-track {
  display: inline-flex;
  align-items: center;
  height: 100%;
  animation: yt-ticker-scroll 45s linear infinite;
  will-change: transform;
}
.yt-ticker:hover .yt-ticker-track { animation-play-state: paused; }
@keyframes yt-ticker-scroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}
.yt-ticker-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  letter-spacing: 0.01em;
  padding: 0 22px;
  flex-shrink: 0;
}
.yt-ticker-item .yt-live-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 6px rgba(255,255,255,0.8);
  flex-shrink: 0;
}
.yt-ticker-item .yt-chan { font-weight: 700; }
.yt-ticker-item .yt-stat { font-weight: 500; color: rgba(255,255,255,0.88); }
.yt-ticker-item .yt-sep { color: rgba(255,255,255,0.5); }

.sidebar {
  background: var(--bg-panel);
  border-right: 1px solid var(--line);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 6px 22px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
}
.brand-mark {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: linear-gradient(155deg, var(--red), var(--red-deep));
  flex-shrink: 0;
}
.brand-text { font-weight: 700; font-size: 14.5px; letter-spacing: 0.01em; }
.brand-text span { display:block; font-weight: 400; font-size: 11px; color: var(--text-faint); }

.nav-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  margin: 6px 8px 8px;
}

.root-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 11px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--text-dim);
  font-size: 14px;
  text-align: left;
  margin-bottom: 4px;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.root-btn:hover { background: var(--bg-panel-2); color: var(--text); }
.root-btn.active {
  background: linear-gradient(135deg, rgba(255,36,64,0.16), rgba(122,13,28,0.1));
  border-color: rgba(255,36,64,0.35);
  color: #fff;
}
.root-btn .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--text-faint);
  flex-shrink: 0;
}
.root-btn.active .dot { background: var(--red); box-shadow: 0 0 8px var(--red); }

.sidebar-footer {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.user-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px;
  font-size: 13px;
  color: var(--text-dim);
}
.user-avatar {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--bg-panel-2);
  border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: var(--red);
  flex-shrink: 0;
}
.logout-btn {
  width: 100%;
  margin-top: 8px;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text-dim);
  padding: 8px;
  border-radius: 7px;
  font-size: 12.5px;
}
.logout-btn:hover { border-color: var(--red); color: #fff; }

/* main panel */
.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  position: relative;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255,36,64,0.04), transparent);
}

.breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  font-size: 13.5px;
  color: var(--text-dim);
  min-width: 0;
}
.breadcrumb button {
  background: none; border: none; color: var(--text-dim);
  padding: 3px 7px; border-radius: 5px; font-size: 13.5px;
}
.breadcrumb button:hover { background: var(--bg-panel-2); color: #fff; }
.breadcrumb button.current { color: #fff; font-weight: 600; }
.breadcrumb .sep { color: var(--text-faint); }

.topbar-actions { display: flex; gap: 8px; flex-shrink: 0; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 13px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: var(--bg-panel-2);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}
.btn:hover { border-color: var(--red); }
.btn.accent {
  background: linear-gradient(135deg, var(--red), var(--red-deep));
  border-color: transparent;
  color: #fff;
  font-weight: 600;
}
.btn.accent:hover { filter: brightness(1.1); }
.btn svg { width: 15px; height: 15px; flex-shrink: 0; }

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 24px;
}
.search-box {
  position: relative;
  width: 260px;
  max-width: 40vw;
}
.search-box input {
  width: 100%;
  padding: 8px 12px 8px 32px;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--text);
  font-size: 13px;
}
.search-box input:focus { outline: none; border-color: var(--red); }
.search-box svg {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  width: 14px; height: 14px; color: var(--text-faint);
}
.view-toggle { display: flex; gap: 4px; }
.view-toggle button {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  color: var(--text-dim);
  padding: 7px 9px;
  border-radius: 6px;
}
.view-toggle button.active { color: #fff; border-color: var(--red); }

.zoom-control {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--text-faint);
}
.zoom-control svg { width: 15px; height: 15px; flex-shrink: 0; }
.zoom-control input[type=range] {
  -webkit-appearance: none;
  appearance: none;
  width: 80px;
  height: 4px;
  background: var(--bg-panel-2);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
  border: 1px solid var(--line);
}
.zoom-control input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 13px; height: 13px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 0 2px var(--bg);
  cursor: pointer;
}
.zoom-control input[type=range]::-moz-range-thumb {
  width: 13px; height: 13px;
  border-radius: 50%;
  background: var(--red);
  border: 2px solid var(--bg);
  cursor: pointer;
}

/* Thumb height scales with card size so proportions stay nice at any zoom */
.item-card .thumb { height: calc(var(--card-size) * 0.48); }

/* file area */
.file-area {
  flex: 1;
  overflow: auto;
  padding: 8px 24px 32px;
  position: relative;
}

/* ---------------- inline video panel ---------------- */
/* Plays right in the file area, above the grid/list, so the rest of the
   current folder stays visible next to it instead of being covered by a
   full-screen overlay or handed off to an external player. */
.video-panel {
  display: none;
  margin: 8px 0 20px;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}
.video-panel.active { display: block; }
.video-panel-player {
  position: relative;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.video-panel-player video {
  width: 100%;
  max-height: min(56vh, 640px);
  display: block;
  background: #000;
}
.video-panel-nav {
  position: absolute;
  top: 50%; transform: translateY(-50%);
  background: rgba(10,10,12,0.55);
  border: 1px solid var(--line);
  color: #fff;
  border-radius: 50%;
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
}
.video-panel-nav:hover { border-color: var(--red); background: rgba(10,10,12,0.8); }
.video-panel-nav.prev { left: 14px; }
.video-panel-nav.next { right: 14px; }
.video-panel-nav svg { width: 16px; height: 16px; }
.video-panel-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-top: 1px solid var(--line);
}
.video-panel-name {
  font-size: 13px;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.video-panel-close {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text-dim);
  padding: 7px 12px;
  border-radius: 7px;
  font-size: 12.5px;
}
.video-panel-close:hover { border-color: var(--red); color: #fff; }
.video-panel-close svg { width: 14px; height: 14px; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--card-size), 1fr));
  gap: 12px;
  padding-top: 8px;
}

.item-card {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 12px 12px;
  cursor: default;
  transition: border-color .15s ease, transform .1s ease, background .15s ease;
  position: relative;
}
.item-card:hover {
  border-color: rgba(255,36,64,0.45);
  background: var(--bg-panel-2);
}
.item-card .icon {
  width: 34px; height: 34px; margin-bottom: 10px;
  color: var(--red);
}
.item-card.is-dir .icon { color: #ff9aa4; }
.item-card .name {
  font-size: 13px;
  font-weight: 500;
  word-break: break-word;
  line-height: 1.35;
  margin-bottom: 4px;
  max-height: 3.6em;
  overflow: hidden;
}
.item-card .meta {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-faint);
}
.item-card .row-actions {
  position: absolute;
  top: 8px; right: 8px;
  display: flex; gap: 4px;
  opacity: 0;
  transition: opacity .12s ease;
}
.item-card:hover .row-actions { opacity: 1; }
.row-actions button {
  width: 26px; height: 26px;
  background: rgba(0,0,0,0.55);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text-dim);
  display: flex; align-items: center; justify-content: center;
}
.row-actions button:hover { color: #fff; border-color: var(--red); }
.row-actions button svg { width: 13px; height: 13px; }

/* list view */
.list { display: none; flex-direction: column; }
.list.active { display: flex; }
.grid.hidden { display: none; }
.list-row {
  display: grid;
  grid-template-columns: 28px 1fr 110px 170px 70px;
  align-items: center;
  gap: 12px;
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.list-row.head {
  color: var(--text-faint);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--line);
}
.list-row:hover:not(.head) { background: var(--bg-panel); }
.list-row .icon { width: 17px; height: 17px; color: var(--red); }
.list-row.is-dir .icon { color: #ff9aa4; }
.list-row .meta { font-family: var(--mono); color: var(--text-faint); font-size: 12px; }
.list-row .actions { display: flex; gap: 4px; justify-content: flex-end; }
.list-row .actions button {
  width: 24px; height: 24px; background: transparent; border: 1px solid var(--line);
  border-radius: 5px; color: var(--text-dim); display: flex; align-items: center; justify-content: center;
}
.list-row .actions button:hover { color: #fff; border-color: var(--red); }
.list-row .actions svg { width: 12px; height: 12px; }

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 20px;
  color: var(--text-faint);
  text-align: center;
}
.empty-state svg { width: 46px; height: 46px; margin-bottom: 14px; color: var(--red-deep); }
.empty-state h3 { color: var(--text-dim); font-size: 15px; margin: 0 0 6px; }
.empty-state p { margin: 0; font-size: 13px; max-width: 280px; }

/* drag & drop vault overlay — the signature moment */
.drop-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(4, 2, 3, 0.88);
  backdrop-filter: blur(3px);
}
.drop-overlay.active { display: flex; }
.drop-overlay::before {
  content: '';
  position: absolute; inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0px, transparent 3px,
    rgba(255,36,64,0.05) 3px, rgba(255,36,64,0.05) 4px
  );
  animation: scan 5s linear infinite;
}
@keyframes scan {
  from { background-position: 0 0; }
  to { background-position: 0 400px; }
}
.drop-panel {
  position: relative;
  border: 2px dashed var(--red);
  border-radius: 18px;
  padding: 60px 90px;
  text-align: center;
  box-shadow: 0 0 90px -10px var(--red-glow);
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 60px -15px var(--red-glow); }
  50% { box-shadow: 0 0 100px -10px var(--red-glow); }
}
.drop-panel svg { width: 52px; height: 52px; color: var(--red); margin-bottom: 16px; }
.drop-panel h2 { margin: 0 0 6px; font-size: 20px; }
.drop-panel p { margin: 0; color: var(--text-dim); font-size: 13.5px; }

/* upload tray */
.upload-tray {
  position: fixed;
  right: 20px; bottom: 20px;
  width: 320px;
  max-width: calc(100vw - 40px);
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.upload-item {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 10px 12px;
  box-shadow: 0 10px 30px -8px rgba(0,0,0,0.6);
}
.upload-item .top {
  display: flex; justify-content: space-between; gap: 8px;
  font-size: 12.5px; margin-bottom: 7px;
}
.upload-item .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-item .pct { color: var(--text-faint); font-family: var(--mono); flex-shrink: 0; }
.upload-item .bar-track {
  height: 5px; background: var(--bg-panel-2); border-radius: 3px; overflow: hidden;
}
.upload-item .bar-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--red-deep), var(--red));
  transition: width .15s ease;
}
.upload-item.done .bar-fill { background: var(--ok); }
.upload-item.error .bar-fill { background: #ff2440; }
.upload-item .status { font-size: 11.5px; color: var(--text-faint); margin-top: 5px; }

.toast {
  position: fixed;
  left: 50%; top: calc(18px + var(--yt-ticker-h)); transform: translateX(-50%) translateY(-14px);
  background: var(--bg-panel-2);
  border: 1px solid var(--line);
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 13px;
  z-index: 60;
  opacity: 0;
  transition: opacity .18s ease, transform .18s ease;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { border-color: rgba(255,36,64,0.5); color: #ff9aa4; }

/* modal */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.65);
  display: none; align-items: center; justify-content: center; z-index: 55;
}
.modal-backdrop.active { display: flex; }
.modal {
  width: 340px;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 22px;
}
.modal h3 { margin: 0 0 14px; font-size: 15px; }
.modal input {
  width: 100%; padding: 9px 11px; margin-bottom: 16px;
  background: #0d0d10; border: 1px solid var(--line); border-radius: 7px;
  color: var(--text); font-size: 13.5px;
}
.modal input:focus { outline: none; border-color: var(--red); }
.modal .modal-actions { display: flex; gap: 8px; justify-content: flex-end; }

/* ---------------- admin nav link ---------------- */
a.root-btn { text-decoration: none; box-sizing: border-box; }
.nav-label.admin-only { margin-top: 14px; }

/* ---------------- search scope toggle ---------------- */
#searchScopeBtn { flex-shrink: 0; }
#searchScopeBtn svg { color: var(--text-faint); }
#searchScopeBtn.active { border-color: var(--red); color: #fff; }
#searchScopeBtn.active svg { color: var(--red); }

/* ---------------- search results (global search mode) ---------------- */
.search-results-list { display: flex; flex-direction: column; padding-top: 8px; }
.search-result-row {
  display: grid;
  grid-template-columns: 28px 1fr 90px;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  font-size: 13px;
}
.search-result-row:hover { background: var(--bg-panel); }
.search-result-row .icon { width: 17px; height: 17px; color: var(--red); flex-shrink: 0; }
.search-result-row.is-dir .icon { color: #ff9aa4; }
.search-result-row .info { min-width: 0; }
.search-result-row .name { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-result-row .path { font-family: var(--mono); font-size: 11px; color: var(--text-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-result-row .meta { font-family: var(--mono); color: var(--text-faint); font-size: 12px; text-align: right; }
.search-truncated-note {
  padding: 10px; text-align: center; color: var(--text-faint); font-size: 12px;
}

/* ---------------- image + video thumbnails ---------------- */
.item-card .thumb {
  width: 100%; height: 72px; margin-bottom: 10px;
  border-radius: 6px; overflow: hidden;
  background: var(--bg-panel-2);
  display: flex; align-items: center; justify-content: center;
}
.item-card .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.item-card .thumb-video { position: relative; }
.item-card .thumb-video video { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.thumb-play-badge {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.28);
  transition: background .15s ease, opacity .2s ease;
}
.item-card:hover .thumb-play-badge { opacity: 0; }
.item-card:hover .thumb-video {
  outline: 2px solid var(--red);
  outline-offset: -2px;
  border-radius: 6px;
}
.thumb-play-badge .icon {
  width: 22px; height: 22px;
  color: #fff;
  filter: drop-shadow(0 1px 4px rgba(0,0,0,0.7));
  fill: rgba(255,255,255,0.92);
  stroke: none;
}
.icon-wrap { position: relative; display: inline-flex; margin-bottom: 10px; }
.icon-wrap .icon { margin-bottom: 0; }
.list-row .thumb { width: 22px; height: 22px; border-radius: 4px; overflow: hidden; flex-shrink: 0; }
.list-row .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.list-row .thumb-video video { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }

/* ---------------- drag & drop moving ---------------- */
.item-card[draggable="true"], .list-row[draggable="true"] { cursor: grab; }
.item-card.drag-source, .list-row.drag-source { opacity: 0.4; }
.item-card.drop-target, .list-row.drop-target {
  border-color: var(--red) !important;
  box-shadow: 0 0 0 2px var(--red-glow) inset;
  background: rgba(255,36,64,0.08);
}
.root-btn.drop-target {
  border-color: var(--red);
  background: rgba(255,36,64,0.16);
  color: #fff;
}
.breadcrumb button.drop-target {
  background: rgba(255,36,64,0.18);
  color: #fff;
  outline: 1px solid var(--red);
}

/* ---------------- move / rename modal ---------------- */
.move-modal { width: 420px; max-width: calc(100vw - 40px); }
.move-picker {
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 16px;
  overflow: hidden;
}
.move-roots {
  display: flex; gap: 6px; padding: 10px; border-bottom: 1px solid var(--line);
  background: var(--bg-panel-2); flex-wrap: wrap;
}
.move-roots button {
  background: var(--bg-panel); border: 1px solid var(--line); color: var(--text-dim);
  padding: 6px 10px; border-radius: 6px; font-size: 12.5px;
}
.move-roots button.active { border-color: var(--red); color: #fff; }
.move-breadcrumb {
  display: flex; flex-wrap: wrap; gap: 3px; padding: 8px 10px;
  font-size: 12px; color: var(--text-dim); border-bottom: 1px solid var(--line);
}
.move-breadcrumb button { background: none; border: none; color: var(--text-dim); padding: 2px 5px; border-radius: 4px; font-size: 12px; }
.move-breadcrumb button:hover { background: var(--bg-panel-2); color: #fff; }
.move-breadcrumb .sep { color: var(--text-faint); }
.move-folder-list { max-height: 220px; overflow-y: auto; }
.move-folder-row {
  display: flex; align-items: center; gap: 8px; padding: 9px 12px;
  font-size: 13px; border-bottom: 1px solid var(--line);
}
.move-folder-row:last-child { border-bottom: none; }
.move-folder-row:hover { background: var(--bg-panel-2); }
.move-folder-row svg { width: 15px; height: 15px; color: #ff9aa4; flex-shrink: 0; }
.move-folder-empty { padding: 20px; text-align: center; color: var(--text-faint); font-size: 12.5px; }

/* ---------------- lightbox ---------------- */
.lightbox {
  position: fixed; inset: 0; z-index: 70;
  display: none; align-items: center; justify-content: center;
  background: rgba(3, 2, 3, 0.94);
  backdrop-filter: blur(4px);
}
.lightbox.active { display: flex; }
.lightbox img { max-width: min(88vw, 1400px); max-height: 80vh; border-radius: 8px; box-shadow: 0 30px 90px -20px rgba(0,0,0,0.9); }
.lightbox-caption {
  position: absolute; bottom: 26px; left: 50%; transform: translateX(-50%);
  color: var(--text-dim); font-size: 13px; text-align: center;
}
.lightbox-close, .lightbox-nav {
  position: absolute;
  background: var(--bg-panel); border: 1px solid var(--line); color: var(--text);
  border-radius: 50%; width: 42px; height: 42px;
  display: flex; align-items: center; justify-content: center;
}
.lightbox-close:hover, .lightbox-nav:hover { border-color: var(--red); color: #fff; }
.lightbox-close { top: 22px; right: 22px; }
.lightbox-nav { top: 50%; transform: translateY(-50%); }
.lightbox-nav.prev { left: 22px; }
.lightbox-nav.next { right: 22px; }
.lightbox-close svg, .lightbox-nav svg { width: 18px; height: 18px; }

/* ---------------- users page ---------------- */
.users-panel { padding: 24px 28px; max-width: 900px; }
.users-panel h1 { font-size: 19px; margin: 0 0 4px; }
.users-panel .sub { color: var(--text-dim); font-size: 13.5px; margin: 0 0 22px; }
.users-toolbar { display: flex; justify-content: flex-end; margin-bottom: 14px; }
.users-table { width: 100%; border-collapse: collapse; background: var(--bg-panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.users-table th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-faint); padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--bg-panel-2);
}
.users-table td { padding: 12px 16px; border-bottom: 1px solid var(--line); font-size: 13.5px; vertical-align: middle; }
.users-table tr:last-child td { border-bottom: none; }
.role-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; letter-spacing: 0.02em;
}
.role-badge.admin { background: rgba(255,36,64,0.15); color: #ff8a97; border: 1px solid rgba(255,36,64,0.35); }
.role-badge.user { background: var(--bg-panel-2); color: var(--text-dim); border: 1px solid var(--line); }
.users-table .row-actions-inline { display: flex; gap: 6px; justify-content: flex-end; }
.users-table .row-actions-inline button {
  background: var(--bg-panel-2); border: 1px solid var(--line); color: var(--text-dim);
  padding: 6px 10px; border-radius: 6px; font-size: 12px;
}
.users-table .row-actions-inline button:hover { border-color: var(--red); color: #fff; }
.users-table .row-actions-inline button.danger:hover { border-color: var(--red); color: #ff8a97; }
.field-hint { font-size: 11.5px; color: var(--text-faint); margin: -12px 0 16px; }
.role-select {
  width: 100%; padding: 9px 11px; margin-bottom: 16px;
  background: #0d0d10; border: 1px solid var(--line); border-radius: 7px;
  color: var(--text); font-size: 13.5px;
}

@media (max-width: 720px) {
  .app { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .sidebar { flex-direction: row; overflow-x: auto; align-items: center; padding: 10px 12px; }
  .brand { border: none; padding: 0 10px 0 0; margin: 0; }
  .nav-label { display: none; }
  .sidebar-footer { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .drop-panel, .drop-overlay::before { animation: none; }
}
