:root{
  --bg:#0b1220;
  --panel:#0f1a2e;
  --panel-2:#0c162a;
  --border:rgba(255,255,255,.08);
  --text:#e8eefc;
  --muted:rgba(232,238,252,.65);
  --muted2:rgba(232,238,252,.4);
  --accent:#47a3ff;
  --good:#4ade80;
  --warn:#fbbf24;
  --bad:#fb7185;
  --shadow: 0 12px 40px rgba(0,0,0,.45);
  --r:14px;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
  background: radial-gradient(1200px 600px at 30% -10%, rgba(71,163,255,.20), transparent 55%),
              radial-gradient(900px 500px at 90% 0%, rgba(250,111,133,.12), transparent 60%),
              var(--bg);
  color:var(--text);
}

a{color:inherit; text-decoration:none}

.app-shell{min-height:100%; display:flex; flex-direction:column}

.topbar{
  position:sticky; top:0; z-index:20;
  display:flex; align-items:center; justify-content:space-between;
  padding:14px 18px;
  background: rgba(10,16,30,.82);
  backdrop-filter: blur(12px);
  border-bottom:1px solid var(--border);
}
.brand{display:flex; gap:12px; align-items:center}
.brand-dot{width:12px; height:12px; border-radius:999px; background:linear-gradient(135deg,#47a3ff,#9a5cff); box-shadow:0 0 0 4px rgba(71,163,255,.14)}
.brand-name{font-weight:700; letter-spacing:.2px}
.brand-sub{font-size:12px; color:var(--muted)}

.topnav{display:flex; gap:8px; align-items:center}
.topnav a{
  padding:8px 10px;
  border-radius:10px;
  color:var(--muted);
  border:1px solid transparent;
}
.topnav a:hover{color:var(--text); border-color:var(--border); background:rgba(255,255,255,.03)}
.topnav a.active{color:var(--text); background:rgba(71,163,255,.10); border-color:rgba(71,163,255,.25)}

.topbar-right{display:flex; gap:10px; align-items:center}
.pill{
  font-size:12px;
  padding:7px 10px;
  border-radius:999px;
  border:1px solid var(--border);
  background:rgba(255,255,255,.03);
  color:var(--muted);
}
.pill:hover{color:var(--text); border-color:rgba(255,255,255,.14)}

.main{display:flex; flex:1; min-height:0}

.sidebar{
  width:270px; flex:0 0 270px;
  background: rgba(10,16,30,.62);
  border-right:1px solid var(--border);
  padding:14px;
  overflow:auto;
}
.sidebar-title{font-weight:700; font-size:12px; color:var(--muted); letter-spacing:.4px; text-transform:uppercase; margin:6px 6px 10px}

.page-list{display:flex; flex-direction:column; gap:8px}
.page-item{
  display:flex; gap:10px; align-items:center;
  padding:10px; border-radius:12px;
  border:1px solid transparent;
  background:rgba(255,255,255,.02);
}
.page-item:hover{border-color:var(--border); background:rgba(255,255,255,.03)}
.page-item.active{border-color:rgba(71,163,255,.35); background:rgba(71,163,255,.10)}
.page-avatar{width:34px; height:34px; border-radius:10px; object-fit:cover; border:1px solid var(--border)}
.page-meta{min-width:0; flex:1}
.page-name{font-weight:650; font-size:13px; line-height:1.1}
.page-handle{font-size:12px; color:var(--muted); overflow:hidden; text-overflow:ellipsis; white-space:nowrap}
.page-dot{width:10px; height:10px; border-radius:999px; border:1px solid var(--border)}
.page-dot.on{background:var(--good)}
.page-dot.off{background:rgba(255,255,255,.18)}

.sidebar-footer{margin-top:14px; padding:10px; border-radius:12px; border:1px dashed rgba(255,255,255,.12); color:var(--muted); font-size:12px}

.content{flex:1; overflow:auto; padding:18px; min-width:0}

.panel{
  background:linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.02));
  border:1px solid var(--border);
  border-radius:var(--r);
  box-shadow: var(--shadow);
}

.hero{
  padding:14px;
  display:flex; gap:14px; align-items:center; justify-content:space-between;
}
.hero-left{display:flex; gap:14px; align-items:center}
.hero-avatar{width:54px; height:54px; border-radius:16px; border:1px solid var(--border); object-fit:cover}
.hero-title{font-weight:800; font-size:18px; margin:0}
.hero-sub{color:var(--muted); font-size:13px}

.kpis{display:flex; gap:10px; flex-wrap:wrap}
.kpi{padding:10px 12px; border-radius:12px; border:1px solid var(--border); background:rgba(255,255,255,.03); min-width:110px}
.kpi .label{font-size:11px; color:var(--muted); text-transform:uppercase; letter-spacing:.4px}
.kpi .value{font-weight:800; font-size:18px; margin-top:4px}

.toolbar{
  margin-top:14px;
  display:flex; gap:10px; flex-wrap:wrap; align-items:center; justify-content:space-between;
}
.toolbar .left{display:flex; gap:10px; flex-wrap:wrap; align-items:center}

.input, select{
  background:rgba(255,255,255,.03);
  color:var(--text);
  border:1px solid var(--border);
  border-radius:12px;
  padding:10px 12px;
  outline:none;
}
.input::placeholder{color:rgba(232,238,252,.35)}
.button{
  border:1px solid rgba(71,163,255,.35);
  background:rgba(71,163,255,.14);
  color:var(--text);
  padding:10px 12px;
  border-radius:12px;
  font-weight:650;
  cursor:pointer;
}
.button:hover{background:rgba(71,163,255,.18)}
.button.ghost{border-color:var(--border); background:rgba(255,255,255,.03); color:var(--muted)}
.button.ghost:hover{color:var(--text)}

.section-title{
  margin:18px 2px 10px;
  font-size:13px;
  color:var(--muted);
  letter-spacing:.35px;
}

.grid{
  display:grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap:12px;
}

.card{
  border-radius:14px;
  border:1px solid var(--border);
  background: rgba(255,255,255,.02);
  overflow:hidden;
  position:relative;
  min-height:170px;
}

.card .thumb{
  width:100%;
  aspect-ratio: 9/16;
  object-fit:cover;
  display:block;
  background:linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.02));
}

.card .overlay{
  position:absolute;
  inset:auto 0 0 0;
  padding:10px;
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap:10px;
  background:linear-gradient(180deg, transparent 0%, rgba(0,0,0,.55) 100%);
}

.metrics{display:flex; gap:8px; flex-wrap:wrap; align-items:center}
.metric{
  font-size:12px;
  padding:5px 8px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.14);
  background:rgba(0,0,0,.32);
  color:rgba(255,255,255,.92);
}
.metric span{color:rgba(255,255,255,.72)}

.card .meta{
  position:absolute;
  top:10px; left:10px; right:10px;
  display:flex; justify-content:space-between; gap:10px; align-items:flex-start;
}
.badge{
  font-size:11px;
  padding:6px 8px;
  border-radius:10px;
  border:1px solid rgba(255,255,255,.14);
  background:rgba(0,0,0,.28);
  color:rgba(255,255,255,.92);
}

.card .caption{
  position:absolute;
  top:44px; left:10px; right:10px;
  font-size:12px;
  color:rgba(255,255,255,.9);
  text-shadow:0 2px 8px rgba(0,0,0,.65);
  display:-webkit-box; -webkit-line-clamp:3; -webkit-box-orient:vertical; overflow:hidden;
}

.empty{
  padding:18px;
  border-radius:14px;
  border:1px dashed rgba(255,255,255,.14);
  color:var(--muted);
}

/* Admin */
.auth-wrap{max-width:420px; margin:60px auto; padding:18px}
.auth-card{padding:18px}
.auth-card h1{margin:0 0 10px}
.form-row{display:flex; flex-direction:column; gap:6px; margin:10px 0}
.form-row label{font-size:12px; color:var(--muted)}
.help{font-size:12px; color:var(--muted)}
.table{
  width:100%; border-collapse:separate; border-spacing:0; overflow:hidden;
  border-radius:14px; border:1px solid var(--border);
}
.table th,.table td{padding:10px 12px; border-bottom:1px solid var(--border); font-size:13px}
.table th{font-size:12px; color:var(--muted); text-transform:uppercase; letter-spacing:.35px; background:rgba(255,255,255,.02); text-align:left}
.table tr:last-child td{border-bottom:none}

@media (max-width: 1200px){
  .grid{grid-template-columns: repeat(3, minmax(0,1fr));}
}
@media (max-width: 940px){
  .sidebar{display:none}
  .grid{grid-template-columns: repeat(2, minmax(0,1fr));}
  .topnav{display:none}
}
@media (max-width: 520px){
  .grid{grid-template-columns: 1fr;}
  .hero{flex-direction:column; align-items:flex-start}
}
