:root {
  --bg: #0a0a0f;
  --surface: rgba(255,255,255,0.04);
  --surface-strong: rgba(255,255,255,0.07);
  --border: rgba(255,255,255,0.08);
  --text: #f5f5f7;
  --muted: rgba(255,255,255,0.5);
  --accent: #0a84ff;
  --accent-2: #5e5ce6;
  --danger: #ff453a;
  --success: #30d158;
  --radius: 16px;
  --radius-sm: 12px;
  --font: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif;
  --mono: 'SF Mono', 'Fira Code', 'JetBrains Mono', monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}
::selection { background: rgba(10,132,255,.35); }

/* LOGIN SCREEN */
.login-screen {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
  background-image: radial-gradient(ellipse at 20% 20%, rgba(10,132,255,.12), transparent 60%),
                    radial-gradient(ellipse at 80% 80%, rgba(94,92,230,.12), transparent 60%);
}
.login-card {
  width: min(380px, 90vw);
  padding: 40px 28px;
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.02));
  border: 1px solid var(--border);
  backdrop-filter: blur(40px) saturate(180%);
  box-shadow: 0 30px 80px rgba(0,0,0,.5);
  text-align: center;
}
.login-icon {
  width: 64px; height: 64px; margin: 0 auto 16px;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: grid; place-items: center;
  font-size: 28px; color: #fff;
  box-shadow: 0 12px 32px rgba(10,132,255,.35);
}
.login-title {
  font-size: 28px; font-weight: 700; letter-spacing: -0.5px; margin-bottom: 6px;
}
.login-sub {
  font-size: 14px; color: var(--muted); margin-bottom: 24px;
}
.input-wrap {
  position: relative; margin-bottom: 14px;
}
.input-wrap i {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  color: var(--muted); font-size: 14px;
}
.input-wrap input {
  width: 100%; padding: 14px 14px 14px 40px;
  border-radius: var(--radius-sm);
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text); font-size: 15px; outline: none;
  transition: border-color .2s, background .2s;
}
.input-wrap input:focus {
  border-color: rgba(10,132,255,.5);
  background: var(--surface-strong);
}
.login-btn {
  width: 100%; padding: 14px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border: 0; color: #fff; font-size: 15px; font-weight: 600;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(10,132,255,.3);
  transition: transform .15s, box-shadow .15s;
}
.login-btn:hover { transform: translateY(-1px); box-shadow: 0 12px 32px rgba(10,132,255,.4); }
.login-btn:active { transform: translateY(0); }
.login-error {
  margin-top: 10px; font-size: 13px; color: var(--danger); min-height: 18px;
}

/* MAIN APP */
.app {
  display: flex; flex-direction: column; height: 100%;
}
.app-header {
  height: 56px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 14px;
  background: rgba(10,10,15,.85);
  backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border);
}
.header-left {
  display: flex; align-items: center; gap: 10px;
}
.menu-btn {
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text); display: grid; place-items: center; cursor: pointer;
}
.app-name {
  font-size: 17px; font-weight: 700; letter-spacing: -0.3px;
}
.header-right {
  display: flex; align-items: center; gap: 8px;
}
.path-breadcrumb {
  font-size: 13px; color: var(--muted);
  font-variant-numeric: tabular-nums;
  max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.theme-btn {
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text); display: grid; place-items: center; cursor: pointer;
  transition: background .15s;
}
.theme-btn:hover { background: var(--surface-strong); }

/* MAIN CONTENT */
.app-main {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  padding: 12px;
}
.toolbar {
  display: flex; gap: 8px; margin-bottom: 10px;
}
.search-box {
  flex: 1; position: relative;
}
.search-box i {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--muted); font-size: 13px;
}
.search-box input {
  width: 100%; padding: 10px 36px 10px 36px;
  border-radius: var(--radius-sm);
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text); font-size: 14px; outline: none;
  transition: border-color .15s, background .15s;
}
.search-box input:focus {
  border-color: rgba(10,132,255,.5);
  background: var(--surface-strong);
}
.clear-btn {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 28px; height: 28px; border-radius: 8px;
  background: var(--surface-strong); border: 0; color: var(--muted);
  display: grid; place-items: center; cursor: pointer;
}
.toolbar-actions {
  display: flex; gap: 4px;
}
.icon-btn {
  width: 38px; height: 38px; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--muted); display: grid; place-items: center; cursor: pointer;
  transition: all .15s;
}
.icon-btn.active, .icon-btn:hover {
  background: var(--surface-strong); color: var(--text); border-color: rgba(255,255,255,.18);
}

.filter-bar {
  display: flex; gap: 6px; overflow-x: auto;
  padding-bottom: 10px; margin-bottom: 4px;
  scrollbar-width: none;
}
.filter-bar::-webkit-scrollbar { display: none; }
.filter-chip {
  flex-shrink: 0; padding: 7px 14px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--muted); font-size: 13px; font-weight: 500;
  cursor: pointer; transition: all .15s;
}
.filter-chip.active {
  background: var(--surface-strong); color: var(--text);
  border-color: rgba(255,255,255,.18);
}

/* ENTRIES */
.entries {
  display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}
.entries.list {
  grid-template-columns: 1fr;
}
.entry {
  position: relative; border-radius: var(--radius); overflow: hidden;
  background: var(--surface); border: 1px solid var(--border);
  cursor: pointer; transition: transform .15s, box-shadow .15s;
  animation: fadeIn .25s ease;
}
.entry:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(0,0,0,.4);
}
.entry-thumb {
  aspect-ratio: 16/10; background: var(--surface-strong);
  display: grid; place-items: center; overflow: hidden;
}
.entry-thumb img {
  width: 100%; height: 100%; object-fit: cover;
}
.entry.is-dir .entry-thumb {
  background: linear-gradient(135deg, rgba(94,92,230,.2), rgba(10,132,255,.2));
  color: var(--accent-2); font-size: 32px;
}
.entry-body {
  padding: 10px 12px;
}
.entry-name {
  font-size: 13px; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.entry-meta {
  font-size: 11px; color: var(--muted); margin-top: 3px;
  font-variant-numeric: tabular-nums;
}
.entry-actions {
  position: absolute; top: 6px; right: 6px;
  display: flex; gap: 4px; opacity: 0; transition: opacity .15s;
}
.entry:hover .entry-actions { opacity: 1; }
.entry-act {
  width: 30px; height: 30px; border-radius: 8px;
  background: rgba(0,0,0,.75); border: 1px solid rgba(255,255,255,.15);
  color: var(--text); display: grid; place-items: center;
  cursor: pointer; backdrop-filter: blur(10px); font-size: 12px;
}
.entry-act.danger:hover {
  background: rgba(255,69,58,.35); border-color: rgba(255,69,58,.6); color: var(--danger);
}

/* SKELETON */
.skeleton {
  display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}
.skel {
  aspect-ratio: 16/10; border-radius: var(--radius);
  background: linear-gradient(90deg, var(--surface) 25%, var(--surface-strong) 50%, var(--surface) 75%);
  background-size: 200% 100%; animation: shimmer 1.5s infinite;
}

/* EMPTY STATE */
.empty {
  text-align: center; padding: 60px 20px;
}
.empty-icon {
  font-size: 48px; color: var(--muted); margin-bottom: 12px; opacity: .6;
}
.empty-title {
  font-size: 18px; font-weight: 600; margin-bottom: 6px;
}
.empty-sub {
  font-size: 13px; color: var(--muted);
}

/* FOOTER / UPLOAD */
.app-footer {
  height: 72px; padding: 10px 14px;
  background: rgba(10,10,15,.85);
  backdrop-filter: blur(20px) saturate(180%);
  border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.upload-zone {
  flex: 1; height: 48px; border-radius: var(--radius-sm);
  border: 2px dashed var(--border); display: grid; place-items: center;
  color: var(--muted); font-size: 13px; cursor: pointer;
  transition: all .15s;
}
.upload-zone.drag {
  border-color: var(--accent); background: rgba(10,132,255,.08); color: var(--accent);
}
.upload-text {
  display: flex; align-items: center; gap: 8px;
}
.fab {
  width: 48px; height: 48px; border-radius: var(--radius);
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border: 0; color: #fff; display: grid; place-items: center;
  cursor: pointer; font-size: 20px;
  box-shadow: 0 8px 24px rgba(10,132,255,.35);
  transition: transform .15s;
}
.fab:hover { transform: scale(1.05); }
.fab:active { transform: scale(.96); }

/* BOTTOM NAV */
.bottom-nav {
  height: 64px; display: flex; justify-content: space-around; align-items: center;
  background: rgba(10,10,15,.85);
  backdrop-filter: blur(20px) saturate(180%);
  border-top: 1px solid var(--border);
}
.nav-item {
  flex: 1; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; background: 0; border: 0; color: var(--muted); font-size: 11px;
  cursor: pointer; transition: color .15s;
}
.nav-item.active { color: var(--accent); }
.nav-item i { font-size: 18px; }

/* PANEL */
.panel, .settings {
  flex: 1; overflow-y: auto; padding: 16px 12px 80px;
}
.panel-container, .settings-container {
  max-width: 960px; margin: 0 auto;
  display: grid; gap: 12px;
}
.panel-card {
  padding: 18px; border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.02));
  border: 1px solid var(--border);
  backdrop-filter: blur(20px) saturate(180%);
  box-shadow: 0 10px 30px rgba(0,0,0,.25);
}
.panel-card-header {
  display: flex; align-items: center; gap: 12px; margin-bottom: 14px;
}
.panel-card-icon {
  width: 40px; height: 40px; border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: grid; place-items: center; color: #fff; font-size: 18px;
}
.panel-card-title {
  font-size: 12px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: .5px;
}
.panel-card-value {
  font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.progress-bar {
  height: 8px; border-radius: 999px;
  background: rgba(255,255,255,.08); overflow: hidden;
}
.progress-fill {
  height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width .6s cubic-bezier(.22,1,.36,1); width: 0;
}
.cat-grid {
  display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px;
}
.cat-chip {
  padding: 5px 10px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border);
  font-size: 12px; color: var(--text);
  display: inline-flex; align-items: center; gap: 4px;
}
.audit-list {
  max-height: 240px; overflow-y: auto; display: flex; flex-direction: column; gap: 4px;
  margin-top: 8px;
}
.audit-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 10px; border-radius: 8px;
  background: rgba(255,255,255,.03); font-size: 12px;
}
.audit-time {
  color: var(--muted); font-variant-numeric: tabular-nums; margin-right: 8px;
}
.audit-action {
  color: var(--text); text-align: right; max-width: 70%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.feature-list {
  display: flex; flex-direction: column; gap: 10px; margin-top: 8px;
}
.feature-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,.05);
}
.feature-item:last-child { border-bottom: none; }
.feature-label {
  font-size: 14px; color: var(--text);
  display: flex; align-items: center; gap: 8px;
}
.feature-label i {
  width: 28px; height: 28px; border-radius: 8px;
  background: var(--surface-strong); display: grid; place-items: center;
  font-size: 13px; color: var(--muted);
}
.toggle {
  position: relative; width: 44px; height: 24px; border-radius: 999px;
  background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.12);
  cursor: pointer; transition: background .2s;
}
.toggle.on {
  background: rgba(16,185,129,.35); border-color: rgba(16,185,129,.5);
}
.toggle-knob {
  position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3);
  transition: transform .2s cubic-bezier(.22,1,.36,1);
}
.toggle.on .toggle-knob { transform: translateX(20px); }

/* SETTINGS */
.setting-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 0; border-bottom: 1px solid rgba(255,255,255,.05);
}
.setting-item:last-of-type { border-bottom: none; }
.setting-label {
  font-size: 15px; font-weight: 500;
}
.logout-btn {
  width: 100%; padding: 14px; margin-top: 16px;
  border-radius: var(--radius-sm);
  background: rgba(255,69,58,.15); border: 1px solid rgba(255,69,58,.3);
  color: var(--danger); font-size: 15px; font-weight: 600;
  cursor: pointer; transition: background .15s;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.logout-btn:hover { background: rgba(255,69,58,.25); }

/* ANIMATIONS */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* RESPONSIVE */
@media (max-width: 640px) {
  .entries { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .login-card { padding: 32px 20px; }
  .path-breadcrumb { display: none; }
}
