*{box-sizing:border-box}

body{
  margin:0;
  font-family:system-ui,-apple-system,Segoe UI,Roboto;
  background:linear-gradient(180deg,#eef4ff,#f7f9ff);
  color:#1f2937;
}

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

/* ================= HEADER (STICKY) ================= */
.topbar{
  position:sticky;
  top:0;
  z-index:1000;
  background:linear-gradient(135deg,#2563eb,#3b82f6);
  padding:12px 16px 10px; /* bawah diperkecil */
  color:#fff;
}

.brand{
  display:flex;
  align-items:center;
  gap:10px;
  font-size:17px;
  font-weight:700;
}

.brand img{
  width:30px;
  height:30px;
  border-radius:10px;
  background:#fff;
  padding:3px;
}

/* ================= CATEGORY MENU (MENEMPEL HEADER) ================= */
.cat-menu{
  position:sticky;
  top:52px; /* HARUS pas dengan tinggi header */
  z-index:999;
  display:flex;
  gap:10px;
  padding:8px 12px 10px; /* atas diperkecil */
  overflow-x:auto;
  background:#f0f4ff;
  border-bottom:1px solid rgba(0,0,0,.05);
}

.cat-menu::-webkit-scrollbar{display:none}

.cat-menu a{
  padding:7px 14px;
  background:#fff;
  border-radius:999px;
  font-size:13px;
  white-space:nowrap;
  box-shadow:0 2px 6px rgba(0,0,0,.08);
}

.cat-menu a.active{
  background:#2563eb;
  color:#fff;
  font-weight:600;
}

/* ================= GRID APK (PADAT & AMAN SCROLL) ================= */
.grid{
  display:grid;
  grid-template-columns:repeat(3,1fr); /* HP 3 kolom */
  gap:10px;
  padding:12px;
  margin-top:4px; /* HILANGKAN CELAH */
}

@media(min-width:480px){
  .grid{grid-template-columns:repeat(4,1fr)}
}
@media(min-width:768px){
  .grid{grid-template-columns:repeat(6,1fr)}
}

/* ================= CARD APK ================= */
.card{
  background:#fff;
  border-radius:14px;
  padding:10px 8px;
  text-align:center;
  box-shadow:0 4px 12px rgba(0,0,0,.08);
  transition:.15s;
}

.card:active{transform:scale(.97)}

.card img{
  width:46px;
  height:46px;
  border-radius:12px;
  margin-bottom:6px;
  object-fit:cover;
}

.card b{
  display:block;
  font-size:12.5px;
  line-height:1.2;
}

.card small{
  color:#6b7280;
  font-size:11px;
}

/* ================= EMPTY ================= */
.empty{
  grid-column:1/-1;
  text-align:center;
  padding:40px;
  color:#6b7280;
}

/* ================= FOOTER ================= */
footer{
  text-align:center;
  padding:18px 12px;
  color:#6b7280;
  font-size:12.5px;
}

/* ================= ADMIN ================= */
.admin-header{
  background:linear-gradient(135deg,#2563eb,#3b82f6);
  color:#fff;
  padding:16px;
  text-align:center;
  font-size:18px;
  font-weight:700;
}

.admin-container{padding:16px}

.admin-card{
  background:#fff;
  border-radius:16px;
  padding:16px;
  box-shadow:0 8px 24px rgba(0,0,0,.12);
  margin-bottom:16px;
}

.admin-card h2{
  margin:0 0 12px;
  font-size:16px;
}

.admin-input{
  width:100%;
  padding:12px;
  border-radius:10px;
  border:1px solid #d1d5db;
  margin-bottom:12px;
}

.admin-btn{
  display:block;
  width:100%;
  padding:12px;
  border-radius:12px;
  background:#2563eb;
  color:#fff;
  border:none;
  font-weight:600;
  text-align:center;
}

.admin-btn.gray{
  background:#e5e7eb;
  color:#111;
}

.admin-menu a{
  display:block;
  padding:14px;
  margin-top:10px;
  background:#eef2ff;
  border-radius:12px;
  font-weight:600;
  text-align:center;
}

/* ================= ADMIN APK LIST ================= */
.apk-item{
  display:flex;
  gap:12px;
  align-items:center;
}

.apk-item img{
  width:44px;
  height:44px;
  border-radius:12px;
}

.apk-info{flex:1}
.apk-info b{font-size:14px}
.apk-info small{color:#6b7280}

.apk-actions a{
  display:inline-block;
  padding:8px 12px;
  border-radius:8px;
  background:#2563eb;
  color:#fff;
  font-size:12px;
  margin-left:6px;
}

.apk-actions a.delete{background:#ef4444}

/* ================= APK DETAIL ================= */
.detail-wrap{padding:20px}

.detail-card{
  max-width:420px;
  margin:0 auto;
  background:#fff;
  padding:20px;
  border-radius:18px;
  box-shadow:0 10px 30px rgba(0,0,0,.12);
  text-align:center;
}

.detail-icon{
  width:80px;
  height:80px;
  border-radius:20px;
  margin-bottom:8px;
}

.detail-cat{
  color:#2563eb;
  font-weight:600;
  margin-bottom:14px;
}

.detail-note{
  font-size:13px;
  color:#6b7280;
  margin-top:12px;
}

/* ================= DOWNLOAD BUTTON ================= */
.download-btn{
  display:block;
  margin-top:18px;
  padding:16px;
  background:linear-gradient(135deg,#22c55e,#16a34a);
  color:#fff;
  border-radius:16px;
  font-size:16px;
  font-weight:800;
  text-align:center;
  box-shadow:0 8px 20px rgba(22,163,74,.45);
}

.download-btn:active{transform:scale(.97)}

/* ================= DRAG HANDLE (ADMIN SORT) ================= */
.drag-handle{
  font-size:20px;
  cursor:grab;
  padding:6px;
  color:#9ca3af;
  touch-action:none;
}

.drag-handle:active{cursor:grabbing}
.sortable-ghost{opacity:.4}
.sortable-chosen{background:#eef2ff}
/* ================= SEARCH BAR ================= */
.search-bar{
  display:flex;
  gap:8px;
  padding:8px;
  background:#f0f4ff;
  position:sticky;
  top:52px; /* pas di bawah header */
  z-index:998;
}

.search-bar input{
  flex:1;
  padding:8px 12px;
  border-radius:14px;
  border:1px solid #dbeafe;
  font-size:14px;
  outline:none;
  background:#fff;
}

.search-bar input:focus{
  border-color:#2563eb;
  box-shadow:0 0 0 3px rgba(37,99,235,.15);
}

.search-bar button{
  width:48px;
  border:none;
  border-radius:14px;
  background:linear-gradient(135deg,#2563eb,#3b82f6);
  color:#fff;
  font-size:18px;
  cursor:pointer;
  box-shadow:0 4px 12px rgba(37,99,235,.4);
}

.search-bar button:active{
  transform:scale(.95);
}