:root{
  --bg:#0b0f14;
  --panel:#0f1620;
  --card:#111b26;
  --line:#1b2a3b;
  --text:#e6eef8;
  --muted:#9cb2c9;
  --accent:#39a0ff;
  --danger:#ff4d4d;
  --radius:14px;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial;
  color:var(--text);
  background:var(--bg);
}

a{color:inherit; text-decoration:none}
.link{color:var(--muted)}
.link:hover{color:var(--text)}

.app{
  display:grid;
  grid-template-columns: 280px 1fr;
  height:100vh;
}

.sidebar{
  border-right:1px solid var(--line);
  padding:18px;
  background:rgba(15,22,32,0.65);
  backdrop-filter: blur(10px);
  display:flex;
  flex-direction:column;
  gap:14px;
}

.brand{
  display:flex;
  gap:12px;
  align-items:center;
  padding:10px 10px;
  border:1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(17,27,38,0.6);
}
.logo{
  width:42px; height:42px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), #7ad3ff);
}
.brand-title{font-weight:800; letter-spacing:.2px}
.brand-user{color:var(--muted); font-size:13px; margin-top:2px}

.cards{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:10px;
}
.card{
  border:1px solid var(--line);
  border-radius: var(--radius);
  padding:10px;
  background: rgba(17,27,38,0.6);
  min-height:88px;
}
.card.big{grid-column:1 / -1}
.card-top{
  display:flex; align-items:center; gap:8px;
  color:var(--muted);
}
.card-ico{font-size:16px}
.card-title{font-size:13px}
.card-val{margin-top:8px; font-weight:800}
.card-sub{margin-top:6px; color:var(--muted); font-size:12px}

.side-footer{
  margin-top:auto;
  padding-top:10px;
  border-top:1px solid var(--line);
}

.main{
  display:flex;
  flex-direction:column;
  min-width:0;
}

.topbar{
  padding:16px 18px;
  border-bottom:1px solid var(--line);
  display:flex;
  gap:12px;
  align-items:center;
  justify-content:space-between;
}

.search input{
  width:min(520px, 45vw);
  background: rgba(17,27,38,0.6);
  border:1px solid var(--line);
  border-radius: 999px;
  padding:12px 14px;
  color:var(--text);
  outline:none;
}
.search input::placeholder{color: #7f97b1}

.filters{
  display:flex;
  gap:10px;
  align-items:center;
}
select{
  background: rgba(17,27,38,0.6);
  border:1px solid var(--line);
  border-radius: 999px;
  padding:10px 12px;
  color:var(--text);
  outline:none;
}

.btn{
  background: rgba(17,27,38,0.9);
  border:1px solid var(--line);
  border-radius: 999px;
  padding:10px 12px;
  color:var(--text);
  cursor:pointer;
}
.btn:hover{border-color:#2c4a6a}
.btn.small{padding:8px 10px; font-size:13px}
.btn.danger{border-color: rgba(255,77,77,.35)}
.btn.danger:hover{border-color: rgba(255,77,77,.7)}

.pill{
  border:1px solid var(--line);
  background: rgba(17,27,38,0.6);
  border-radius: 999px;
  padding:10px 12px;
  color:var(--muted);
  font-size:13px;
}

.dropzone{
  margin:16px 18px 0 18px;
  border:1px dashed #2a4462;
  border-radius: var(--radius);
  background: rgba(17,27,38,0.35);
  position:relative;
  overflow:hidden;
}
.drop-inner{padding:18px}
.drop-title{font-weight:900}
.drop-sub{margin-top:6px; color:var(--muted)}
.fake-link{color:var(--accent); cursor:pointer}
.drop-hint{margin-top:8px; color:#7f97b1; font-size:12px}

.drop-overlay{
  position:absolute; inset:0;
  display:flex; align-items:center; justify-content:center;
  background: rgba(57,160,255,.12);
  border:2px solid rgba(57,160,255,.35);
  font-weight:900;
  opacity:0; pointer-events:none;
  transition: .15s;
}
.drop-overlay.show{opacity:1}

.grid{
  padding:16px 18px 22px 18px;
  display:grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap:12px;
  overflow:auto;
}

.file{
  border:1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(17,27,38,0.6);
  padding:12px;
  display:flex;
  gap:12px;
  align-items:center;
  min-width:0;
}
.thumb{
  width:44px; height:44px;
  border-radius: 12px;
  border:1px solid #244057;
  background: rgba(15,22,32,0.8);
  display:flex; align-items:center; justify-content:center;
  font-size:18px;
  flex:0 0 auto;
}
.meta{min-width:0; flex: 1}
.name{
  font-weight:800;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.sub{
  margin-top:6px;
  color:var(--muted);
  font-size:12px;
  display:flex;
  gap:6px;
  flex-wrap:wrap;
}
.actions{
  display:flex;
  flex-direction:column;
  gap:8px;
  flex:0 0 auto;
}

.toast{
  position: fixed;
  right: 18px;
  bottom: 18px;
  background: rgba(17,27,38,0.9);
  border:1px solid var(--line);
  padding:12px 14px;
  border-radius: 999px;
  color: var(--text);
  opacity:0;
  transform: translateY(8px);
  transition:.2s;
  pointer-events:none;
}
.toast.show{opacity:1; transform: translateY(0)}

.login{
  display:flex;
  align-items:center;
  justify-content:center;
  padding:24px;
}
.login-card{
  width:min(420px, 92vw);
  border:1px solid var(--line);
  background: rgba(17,27,38,0.6);
  border-radius: var(--radius);
  padding:18px;
}
.login-title{font-weight:900; font-size:20px}
.login-sub{color:var(--muted); margin-top:6px; margin-bottom:14px}
.login-card input{
  width:100%;
  padding:12px 12px;
  margin:8px 0;
  border-radius: 12px;
  border:1px solid var(--line);
  background: rgba(15,22,32,0.8);
  color:var(--text);
  outline:none;
}
.login-card button{
  width:100%;
  margin-top:10px;
  padding:12px 12px;
  border-radius: 999px;
  border:1px solid #2c4a6a;
  background: rgba(57,160,255,0.18);
  color:var(--text);
  cursor:pointer;
}
.err{color: #ff8080; margin-top:10px; min-height:18px}

@media (max-width: 980px){
  .app{grid-template-columns: 1fr}
  .sidebar{display:none}
  .grid{grid-template-columns: 1fr}
  .search input{width: 52vw}
}

.thumbimg{
  width:44px; height:44px;
  border-radius:12px;
  object-fit:cover;
  border:1px solid #244057;
  background: rgba(15,22,32,0.8);
}

.file.uploading .bar{
  height:8px; margin-top:10px;
  border-radius:999px;
  border:1px solid var(--line);
  background: rgba(15,22,32,0.7);
  overflow:hidden;
}
.file.uploading .barin{
  height:100%;
  width:0%;
  background: rgba(57,160,255,0.45);
}
.file.errup{ border-color: rgba(255,77,77,.6); }

/* NUEVO: panel filtros + load more */
.filterpanel{
  margin: 10px 18px 0 18px;
  border:1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(17,27,38,0.45);
}
.filtergrid{
  display:grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap:10px;
  padding:12px;
}
.frow{ display:flex; flex-direction:column; gap:6px; }
.frow label{ color:var(--muted); font-size:12px; }
.frow input, .frow select{
  background: rgba(17,27,38,0.6);
  border:1px solid var(--line);
  border-radius: 12px;
  padding:10px 12px;
  color:var(--text);
  outline:none;
}
.frow.actions{ grid-column: span 2; flex-direction:row; align-items:flex-end; }
.frow.actions .btn{ width: 100%; }

.loadmore-wrap{ padding: 0 18px 18px; }
#btnLoadMore{ width: 100%; }

@media (max-width: 980px){
  .filtergrid{ grid-template-columns: 1fr 1fr; }
  .frow.actions{ grid-column: 1 / -1; }
}