:root{
  --bg:#0f0f10; --panel:#181819; --line:#2a2a2c; --text:#f2f2f2;
  --muted:#9a9a9e; --accent:#111; --accent-2:#ffffff; --danger:#e05252;
  --radius:14px;
}
*{box-sizing:border-box}
html,body{margin:0;padding:0}
body{
  background:var(--bg); color:var(--text);
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
  -webkit-font-smoothing:antialiased; min-height:100vh;
}
img{display:block; max-width:100%}
a{color:inherit}

/* ---------- Login gate ---------- */
.gate{min-height:100vh; display:flex; align-items:center; justify-content:center; padding:24px}
.gate-card{
  background:var(--panel); border:1px solid var(--line); border-radius:20px;
  padding:36px 28px; width:100%; max-width:380px; text-align:center;
  box-shadow:0 20px 60px rgba(0,0,0,.4);
}
.gate-logo{width:84px; height:84px; margin:0 auto 14px; filter:invert(1)}
.couple-img{
  width:auto; max-width:220px; max-height:180px; margin:4px auto 16px;
}
.gate h1{font-size:1.35rem; margin:.2em 0 .1em}
.gate form{display:flex; flex-direction:column; gap:12px; margin:20px 0 10px}
input[type=password]{
  width:100%; padding:14px 16px; font-size:1rem; border-radius:12px;
  border:1px solid var(--line); background:#0d0d0e; color:var(--text); outline:none;
}
input[type=password]:focus{border-color:#555}
button{font-family:inherit; cursor:pointer}
.gate button{
  padding:14px 16px; font-size:1rem; font-weight:600; border:none; border-radius:12px;
  background:var(--accent-2); color:#111;
}
.muted{color:var(--muted)}
.small{font-size:.82rem}
.error{color:var(--danger); font-size:.9rem; margin:4px 0}

/* ---------- Topbar ---------- */
.topbar{
  position:sticky; top:0; z-index:20; display:flex; align-items:center; justify-content:space-between;
  gap:12px; padding:12px 16px; padding-top:calc(12px + env(safe-area-inset-top));
  background:rgba(15,15,16,.82); backdrop-filter:saturate(160%) blur(12px);
  border-bottom:1px solid var(--line);
}
.brand{display:flex; align-items:center; gap:10px; min-width:0}
.brand-logo{width:38px; height:38px; filter:invert(1); flex:none}
.brand-title{font-weight:700; font-size:1rem; line-height:1.1}
.brand-sub{color:var(--muted); font-size:.8rem}
nav{display:flex; gap:8px; flex:none}

.btn{
  display:inline-flex; align-items:center; justify-content:center; gap:6px;
  padding:9px 14px; border-radius:10px; font-size:.9rem; font-weight:600;
  text-decoration:none; border:1px solid transparent; white-space:nowrap;
}
.btn.ghost{background:transparent; border-color:var(--line); color:var(--text)}
.btn.ghost:active{background:#222}
.btn.primary{background:var(--accent-2); color:#111; border:none}
.btn.primary:disabled{opacity:.4}

/* ---------- Toolbar seleccion ---------- */
.toolbar{
  position:sticky; top:63px; z-index:15; display:flex; align-items:center; justify-content:space-between;
  gap:10px; padding:10px 16px; background:rgba(15,15,16,.9); backdrop-filter:blur(10px);
  border-bottom:1px solid var(--line); flex-wrap:wrap;
}
.selcount{color:var(--muted); font-size:.9rem}
.selcount #selCount{color:var(--text); font-weight:700}
.toolbar-actions{display:flex; gap:8px; flex-wrap:wrap}

/* ---------- Grid ---------- */
.grid,.admin-grid{
  display:grid; gap:6px; padding:6px;
  grid-template-columns:repeat(auto-fill,minmax(150px,1fr));
}
@media(min-width:700px){ .grid,.admin-grid{gap:10px; padding:12px; grid-template-columns:repeat(auto-fill,minmax(200px,1fr))} }
.cell{
  position:relative; margin:0; aspect-ratio:1/1; overflow:hidden; border-radius:10px;
  background:#1c1c1e; cursor:pointer;
}
.cell img{width:100%; height:100%; object-fit:cover; transition:transform .25s}
.cell:active img{transform:scale(.98)}
.cell .pick{position:absolute; opacity:0; width:0; height:0; pointer-events:none}
.cell .check{
  position:absolute; top:8px; left:8px; width:26px; height:26px; border-radius:50%;
  border:2px solid rgba(255,255,255,.9); background:rgba(0,0,0,.28);
  transition:all .15s; pointer-events:none;
}
.cell.selected .check{background:var(--accent-2); border-color:var(--accent-2)}
.cell.selected .check::after{
  content:"\2713"; color:#111; font-size:16px; font-weight:900;
  position:absolute; inset:0; display:flex; align-items:center; justify-content:center;
}
.cell.selected{outline:3px solid var(--accent-2); outline-offset:-3px}
.cell .dl-one{
  position:absolute; bottom:8px; right:8px; width:32px; height:32px; border-radius:50%;
  background:rgba(0,0,0,.55); color:#fff; display:flex; align-items:center; justify-content:center;
  font-size:18px; text-decoration:none; opacity:0; transition:opacity .15s;
}
.cell:hover .dl-one{opacity:1}
@media(hover:none){ .cell .dl-one{opacity:.9} }

.empty{text-align:center; color:var(--muted); padding:60px 20px}
.notice{margin:12px 16px 0; padding:10px 14px; background:#1d2a1d; border:1px solid #2f4f2f; border-radius:10px; color:#bfe6bf; font-size:.9rem}

/* ---------- Lightbox ---------- */
.lightbox{
  position:fixed; inset:0; z-index:50; background:rgba(0,0,0,.94);
  display:flex; align-items:center; justify-content:center; padding:16px;
}
.lightbox[hidden]{display:none}
.lightbox img{max-width:100%; max-height:86vh; object-fit:contain; border-radius:6px}
.lb-close{
  position:absolute; top:calc(12px + env(safe-area-inset-top)); right:14px; z-index:2;
  width:44px; height:44px; border-radius:50%; border:none; background:rgba(255,255,255,.12);
  color:#fff; font-size:26px; line-height:1;
}
.lb-nav{
  position:absolute; top:50%; transform:translateY(-50%); z-index:2;
  width:48px; height:48px; border-radius:50%; border:none; background:rgba(255,255,255,.12);
  color:#fff; font-size:30px; line-height:1;
}
.lb-prev{left:10px} .lb-next{right:10px}
.lb-download{position:absolute; bottom:calc(18px + env(safe-area-inset-bottom)); left:50%; transform:translateX(-50%)}

/* ---------- Footer ---------- */
.foot{
  display:flex; align-items:center; justify-content:center; gap:8px;
  padding:26px 16px calc(26px + env(safe-area-inset-bottom)); color:var(--muted); font-size:.8rem;
}
.foot-logo{width:20px; height:20px; filter:invert(1); opacity:.7}

/* ---------- Uploader (admin) ---------- */
.uploader{padding:16px}
.dropzone{
  display:block; border:2px dashed var(--line); border-radius:var(--radius);
  padding:34px 20px; text-align:center; cursor:pointer; transition:all .15s; background:var(--panel);
}
.dropzone.drag{border-color:var(--accent-2); background:#202021}
.dz-icon{font-size:38px; margin-bottom:8px}
.dz-text{font-size:1.05rem; margin-bottom:6px}
.upload-status{margin:14px 0 0; display:flex; flex-direction:column; gap:8px}
.up-row{display:flex; align-items:center; gap:10px; font-size:.88rem; background:var(--panel); border:1px solid var(--line); border-radius:10px; padding:8px 12px}
.up-bar{flex:1; height:6px; border-radius:3px; background:#2a2a2c; overflow:hidden}
.up-bar i{display:block; height:100%; width:0; background:var(--accent-2); transition:width .2s}
.up-ok{color:#8fdf8f} .up-err{color:var(--danger)}

.del-form{position:absolute; top:6px; right:6px}
.del-btn{
  width:30px; height:30px; border-radius:50%; border:none; background:rgba(0,0,0,.6);
  color:#fff; font-size:18px; line-height:1;
}
.del-btn:active{background:var(--danger)}
