/* =======================================================================
   NEXA PERPUSTAKAAN — tema glassmorphism ungu (dinamis, modern)
   Ekosistem Literasi & Hub Belajar Pintar — MTsN 3 Kota Surabaya
   ======================================================================= */
:root {
  --ink: #1F1B3A;
  --muted: #635F82;
  --primary: #4F46E5;
  --violet: #8B5CF6;
  --grad: linear-gradient(135deg, #4F46E5, #8B5CF6);
  --grad-soft: linear-gradient(135deg, rgba(79,70,229,.10), rgba(139,92,246,.10));
  --bg: #F3F0FF;
  --glass: rgba(255, 255, 255, .58);
  --glass-strong: rgba(255, 255, 255, .8);
  --border: rgba(255, 255, 255, .8);
  --line: rgba(31, 27, 58, .10);
  --shadow: 0 10px 34px rgba(79, 70, 229, .10);
  --radius: 16px;
  --green: #10B981;
  --amber: #F59E0B;
  --red: #EF4444;
  --sky: #0EA5E9;
  --pink: #EC4899;
  --sidebar-w: 268px;
  --topbar-h: 64px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1000px 600px at 88% -10%, rgba(139, 92, 246, .18), transparent 60%),
    radial-gradient(820px 520px at -8% 18%, rgba(79, 70, 229, .14), transparent 60%),
    radial-gradient(720px 520px at 108% 92%, rgba(236, 72, 153, .10), transparent 60%),
    radial-gradient(620px 420px at 16% 100%, rgba(56, 189, 248, .12), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  min-height: 100vh;
  line-height: 1.55;
}
a { color: var(--primary); text-decoration: none; }
img { max-width: 100%; }

/* ======================= LAYOUT ======================= */
.app { display: flex; min-height: 100vh; }
.main { flex: 1; min-width: 0; margin-left: var(--sidebar-w); }
.content { padding: 26px 30px 60px; max-width: 1320px; }

.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 60;
  display: flex; flex-direction: column;
  background: rgba(255,255,255,.64);
  backdrop-filter: blur(22px) saturate(180%);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
  border-right: 1px solid var(--border);
  box-shadow: 6px 0 30px rgba(79,70,229,.06);
  overflow-y: auto;
  transition: transform .25s ease;
}
.brand { padding: 20px 20px 14px; display: flex; gap: 12px; align-items: center; border-bottom: 1px solid var(--line); }
.brand-logo {
  width: 44px; height: 44px; border-radius: 13px; flex: 0 0 auto;
  background: var(--grad); color: #fff; display: grid; place-items: center;
  font-weight: 800; font-size: 18px; box-shadow: 0 8px 20px rgba(99,102,241,.35);
}
.brand-logo-img {
  width: 44px; height: 44px; border-radius: 13px; flex: 0 0 auto; object-fit: contain;
  background: #fff; padding: 5px; border: 1px solid var(--border); box-shadow: 0 8px 20px rgba(99,102,241,.25);
}
.brand-txt { min-width: 0; }
.brand-txt b { display: block; font-size: 15.5px; letter-spacing: .2px; line-height: 1.2; }
.brand-txt span { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .7px; font-weight: 600; }
.nav { padding: 12px 12px 22px; display: flex; flex-direction: column; gap: 3px; }
.nav-label { font-size: 10px; text-transform: uppercase; letter-spacing: 1.2px; color: var(--muted); font-weight: 700; padding: 12px 10px 4px; }
.nav-link {
  display: flex; align-items: center; gap: 10px; padding: 9.5px 12px; border-radius: 11px;
  color: #43386f; font-size: 13.5px; font-weight: 500; transition: all .15s ease;
}
.nav-link:hover { background: rgba(99,102,241,.10); color: var(--primary); }
.nav-link.active { background: var(--grad); color: #fff; font-weight: 600; box-shadow: 0 8px 18px rgba(99,102,241,.35); }
.nav-link.active .nav-ico { filter: none; }
.nav-ico { width: 20px; text-align: center; font-size: 15px; }
.nav-pill { margin-left: auto; background: rgba(239,68,68,.9); color: #fff; font-size: 10px; font-weight: 800; padding: 1px 6px; border-radius: 999px; }
.sidebar-foot { margin-top: auto; padding: 14px 20px 18px; font-size: 11px; color: var(--muted); border-top: 1px solid var(--line); line-height: 1.6; }

.topbar {
  position: sticky; top: 0; z-index: 40; height: var(--topbar-h);
  display: flex; align-items: center; gap: 14px; padding: 0 26px;
  background: rgba(255,255,255,.55); backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border);
}
.topbar h1 { font-size: 17px; font-weight: 700; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hamburger { display: none; background: none; border: 0; font-size: 20px; cursor: pointer; color: var(--ink); padding: 6px; border-radius: 8px; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; background: var(--grad); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 14px; flex: 0 0 auto;
}
.avatar-rank { box-shadow: 0 0 0 2px #fff, 0 0 0 4px rgba(139,92,246,.4); }

/* dropdown (bell & user) */
.dd { position: relative; }
.dd > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 11px; transition: background .15s; }
.dd > summary::-webkit-details-marker { display: none; }
.dd > summary:hover { background: rgba(99,102,241,.10); }
.dd[open] > summary { background: rgba(99,102,241,.12); }
.bell-ico { font-size: 18px; position: relative; }
.bell-count {
  position: absolute; top: -6px; right: -9px; min-width: 17px; height: 17px; padding: 0 4px;
  background: var(--red); color: #fff; font-size: 10.5px; font-weight: 700; border-radius: 10px;
  display: grid; place-items: center; border: 2px solid #fff;
}
.dd-panel {
  position: absolute; right: 0; top: calc(100% + 8px); width: 340px; max-width: 92vw;
  background: var(--glass-strong); backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; z-index: 70;
}
.dd-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--line); font-weight: 700; font-size: 13px; }
.dd-head a { font-size: 11.5px; color: var(--muted); }
.dd-item { display: block; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.dd-item:hover { background: rgba(99,102,241,.08); }
.dd-item.unread { background: rgba(99,102,241,.07); }
.dd-item b { font-size: 12.5px; display: block; }
.dd-item p { font-size: 12px; color: var(--muted); margin-top: 1px; }
.dd-item time { font-size: 10.5px; color: var(--muted); opacity: .8; }
.dd-empty { padding: 22px; text-align: center; color: var(--muted); font-size: 12.5px; }

/* ======================= KARTU & GRID ======================= */
.card {
  background: var(--glass);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 22px 24px;
}
.card + .card { margin-top: 20px; }
.card-title { font-size: 14px; font-weight: 700; display: flex; align-items: center; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.card-title .subtle { font-size: 11.5px; color: var(--muted); font-weight: 500; margin-left: auto; }
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-5 { grid-template-columns: repeat(5, 1fr); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.grid-buku { display: grid; gap: 20px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }

.stat {
  background: var(--glass); backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px 18px; display: flex; align-items: center; gap: 13px; min-width: 0;
}
.stat-ico { width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; font-size: 19px; flex: 0 0 auto; background: var(--grad-soft); }
.stat b { display: block; font-size: 22px; font-weight: 800; letter-spacing: -.5px; line-height: 1.15; }
.stat span { font-size: 11px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }

/* ======================= TABEL ======================= */
.table-wrap { overflow-x: auto; border-radius: 12px; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; padding: 10px 12px; font-size: 11px; text-transform: uppercase; letter-spacing: .7px; color: var(--muted); border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover { background: rgba(99,102,241,.05); }
.tbl .sub { color: var(--muted); font-size: 12px; }
.tbl-compact td, .tbl-compact th { padding: 7px 10px; }

/* ======================= BADGE ======================= */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3.5px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; letter-spacing: .3px; white-space: nowrap; }
.badge-hijau, .badge-green { background: rgba(16,185,129,.14); color: #047857; }
.badge-kuning, .badge-amber { background: rgba(245,158,11,.16); color: #b45309; }
.badge-merah, .badge-red { background: rgba(239,68,68,.13); color: #b91c1c; }
.badge-biru { background: rgba(14,165,233,.15); color: #0369a1; }
.badge-ungu, .badge-violet { background: rgba(139,92,246,.15); color: #7c3aed; }
.badge-abu, .badge-gray { background: rgba(31,27,58,.07); color: var(--muted); }
.badge-pink { background: rgba(236,72,153,.13); color: #be185d; }

/* ======================= TOMBOL ======================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 16px; border-radius: 11px; border: 1px solid transparent;
  font-size: 13px; font-weight: 600; cursor: pointer; transition: all .15s ease;
  font-family: inherit; line-height: 1.2; white-space: nowrap;
}
.btn-primary { background: var(--grad); color: #fff; box-shadow: 0 8px 18px rgba(99,102,241,.32); }
.btn-primary:hover { filter: brightness(1.06); transform: translateY(-1px); }
.btn-outline { background: transparent; border-color: rgba(79,70,229,.4); color: var(--primary); }
.btn-outline:hover { background: rgba(99,102,241,.08); }
.btn-ghost { background: rgba(255,255,255,.5); border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { background: rgba(255,255,255,.85); }
.btn-danger { background: rgba(239,68,68,.1); color: #b91c1c; border-color: rgba(239,68,68,.25); }
.btn-danger:hover { background: var(--red); color: #fff; }
.btn-success { background: rgba(16,185,129,.12); color: #047857; border-color: rgba(16,185,129,.3); }
.btn-success:hover { background: var(--green); color: #fff; }
.btn-wa { background: rgba(16,185,129,.12); color: #047857; border-color: rgba(16,185,129,.3); }
.btn-sm { padding: 6px 11px; font-size: 12px; border-radius: 9px; }
.btn-lg { padding: 13px 24px; font-size: 14.5px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-ico { display: inline-flex; width: 30px; height: 30px; padding: 0; align-items: center; justify-content: center; border-radius: 9px; font-size: 14px; }

/* ======================= FORM ======================= */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px 18px; }
.form-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px 18px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 12px; font-weight: 600; color: #4b4178; }
.field label .req { color: var(--red); }
.field input, .field select, .field textarea {
  width: 100%; padding: 10px 13px; border-radius: 11px; border: 1px solid rgba(31,27,58,.16);
  background: rgba(255,255,255,.75); color: var(--ink); font-size: 13.5px; font-family: inherit;
  transition: border .15s, box-shadow .15s; outline: none;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99,102,241,.16); }
.field textarea { resize: vertical; min-height: 76px; }
.field .hint { font-size: 11.5px; color: var(--muted); }
.form-actions { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
.check-line { display: flex; align-items: center; gap: 9px; font-size: 13px; font-weight: 500; }

.file-drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  border: 2px dashed rgba(99,102,241,.35); border-radius: 13px; padding: 24px 18px;
  background: rgba(255,255,255,.45); cursor: pointer; text-align: center; transition: all .15s;
}
.file-drop:hover { border-color: var(--primary); background: rgba(255,255,255,.7); }
.file-drop b { font-size: 13px; }
.file-drop span { font-size: 11.5px; color: var(--muted); }
.file-drop input { display: none; }
.file-drop.has-file { border-color: var(--green); background: rgba(16,185,129,.07); }

.filter-bar { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; align-items: end; }
.filter-bar .field { margin-bottom: 0; }
.filter-bar .btn { height: 40px; }

/* ======================= FLASH ======================= */
.flash { padding: 12px 16px; border-radius: 12px; font-size: 13px; font-weight: 600; margin-bottom: 18px; display: flex; align-items: center; gap: 9px; animation: flashIn .25s ease; }
.flash-success { background: rgba(16,185,129,.13); color: #047857; border: 1px solid rgba(16,185,129,.3); }
.flash-error { background: rgba(239,68,68,.12); color: #b91c1c; border: 1px solid rgba(239,68,68,.3); }
.flash-info { background: rgba(99,102,241,.12); color: var(--primary); border: 1px solid rgba(99,102,241,.3); }
.flash-warning { background: rgba(245,158,11,.13); color: #b45309; border: 1px solid rgba(245,158,11,.35); }
@keyframes flashIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* ======================= GRAFIK (CSS) ======================= */
.chart { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: grid; grid-template-columns: minmax(110px, 190px) 1fr 52px; gap: 10px; align-items: center; font-size: 12.5px; }
.bar-label { color: #4b4178; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { height: 18px; background: rgba(99,102,241,.09); border-radius: 9px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 9px; background: var(--grad); min-width: 2px; transition: width .6s cubic-bezier(.22,1,.36,1); }
.bar-row:nth-child(3n+2) .bar-fill { background: linear-gradient(135deg, #0EA5E9, #6366F1); }
.bar-row:nth-child(3n+3) .bar-fill { background: linear-gradient(135deg, #EC4899, #8B5CF6); }
.bar-val { text-align: right; font-weight: 700; }

/* ======================= MISC ======================= */
.page-head { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h2 { font-size: 21px; font-weight: 800; letter-spacing: -.3px; }
.page-head .sub { font-size: 12.5px; color: var(--muted); }
.page-head .actions { margin-left: auto; display: flex; gap: 9px; flex-wrap: wrap; }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty .empty-ico { font-size: 38px; display: block; margin-bottom: 10px; }
.empty b { display: block; color: var(--ink); font-size: 14.5px; margin-bottom: 4px; }
.empty p { font-size: 12.5px; }
.muted { color: var(--muted); }
.mt-0 { margin-top: 0; } .mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-20 { margin-top: 20px; } .mt-28 { margin-top: 28px; }
.mb-0 { margin-bottom: 0; } .mb-8 { margin-bottom: 8px; } .mb-16 { margin-bottom: 16px; }
.flex { display: flex; } .flex-wrap { flex-wrap: wrap; } .items-center { align-items: center; } .gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.ml-auto { margin-left: auto; }
.fs-12 { font-size: 12px; } .fs-13 { font-size: 13px; }
.w-100 { width: 100%; }
.text-right { text-align: right; }
.nowrap { white-space: nowrap; }
.mono { font-family: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace; }

.detail-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px 22px; }
.detail-item .k { font-size: 11px; text-transform: uppercase; letter-spacing: .7px; color: var(--muted); font-weight: 700; }
.detail-item .v { font-size: 13.5px; font-weight: 600; margin-top: 2px; word-break: break-word; }
.detail-grid-3 { grid-template-columns: repeat(3, 1fr); }

.pager { display: flex; align-items: center; gap: 12px; justify-content: center; margin-top: 18px; font-size: 12.5px; }
.pager a { padding: 7px 13px; border-radius: 10px; background: rgba(255,255,255,.6); border: 1px solid var(--line); font-weight: 600; }
.pager a:hover { background: rgba(99,102,241,.12); }
.pager-info { color: var(--muted); }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; background: rgba(255,255,255,.7); border: 1px solid var(--line); font-size: 12px; font-weight: 600; }
.chip-aktif { background: var(--grad); color: #fff; border-color: transparent; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }

/* ======================= KATALOG: KARTU BUKU ======================= */
.buku-card {
  background: var(--glass); backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow);
  overflow: hidden; display: flex; flex-direction: column; transition: transform .18s ease, box-shadow .18s ease;
}
.buku-card:hover { transform: translateY(-4px); box-shadow: 0 16px 40px rgba(79,70,229,.18); }
.buku-cover { aspect-ratio: 3 / 4; background: linear-gradient(135deg, rgba(79,70,229,.16), rgba(139,92,246,.16)); display: grid; place-items: center; overflow: hidden; position: relative; }
.buku-cover img { width: 100%; height: 100%; object-fit: cover; }
.buku-cover .cover-fallback { font-size: 42px; opacity: .8; }
.buku-cover .media-tag { position: absolute; top: 8px; right: 8px; background: rgba(255,255,255,.9); border-radius: 999px; padding: 3px 9px; font-size: 10.5px; font-weight: 700; }
.buku-body { padding: 13px 14px 15px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.buku-judul { font-size: 13.5px; font-weight: 700; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.buku-penulis { font-size: 11.5px; color: var(--muted); }
.buku-meta { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--muted); margin-top: auto; padding-top: 8px; }
.bintang { color: #F59E0B; letter-spacing: 1px; }
.rak-visual { display: grid; gap: 18px; }
.rak { background: rgba(255,255,255,.42); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.rak-head { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 13px; margin-bottom: 12px; }
.rak-row { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 6px; }
.rak-buku { flex: 0 0 92px; text-align: center; }
.rak-buku .spine {
  height: 118px; border-radius: 5px 9px 9px 5px; background: var(--grad); color: #fff;
  display: flex; align-items: center; justify-content: center; padding: 8px 6px;
  font-size: 10.5px; font-weight: 700; line-height: 1.3; overflow: hidden; text-align: center;
  box-shadow: 0 6px 14px rgba(79,70,229,.22); transition: transform .15s;
}
.rak-buku:nth-child(4n+2) .spine { background: linear-gradient(135deg,#0EA5E9,#6366F1); }
.rak-buku:nth-child(4n+3) .spine { background: linear-gradient(135deg,#EC4899,#8B5CF6); }
.rak-buku:nth-child(4n+4) .spine { background: linear-gradient(135deg,#F59E0B,#EC4899); }
.rak-buku:hover .spine { transform: translateY(-6px) rotate(-1deg); }
.rak-buku .rk { font-size: 10px; color: var(--muted); margin-top: 6px; display: block; }

/* ======================= GAMIFIKASI ======================= */
.level-card { background: var(--grad); color: #fff; border-radius: 16px; padding: 20px 22px; box-shadow: 0 14px 34px rgba(79,70,229,.3); }
.level-card .lv-top { display: flex; align-items: center; gap: 14px; }
.level-card .lv-ico { width: 56px; height: 56px; border-radius: 16px; background: rgba(255,255,255,.18); display: grid; place-items: center; font-size: 26px; }
.level-card b { font-size: 22px; display: block; line-height: 1.2; }
.level-card small { opacity: .9; font-size: 12px; }
.level-track { height: 10px; border-radius: 999px; background: rgba(255,255,255,.25); margin-top: 14px; overflow: hidden; }
.level-fill { height: 100%; background: #fff; border-radius: 999px; transition: width .6s ease; }
.lencana-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.lencana { text-align: center; padding: 16px 12px; border-radius: 14px; background: rgba(255,255,255,.5); border: 1px solid var(--line); }
.lencana .lk { font-size: 30px; display: block; margin-bottom: 6px; }
.lencana b { font-size: 12.5px; display: block; }
.lencana small { font-size: 11px; color: var(--muted); }
.lencana.belum { opacity: .48; filter: grayscale(1); }
.podium { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; align-items: end; }
.podium .pod { text-align: center; padding: 16px 10px; border-radius: 15px; background: rgba(255,255,255,.55); border: 1px solid var(--line); }
.podium .pod.p1 { background: linear-gradient(160deg, rgba(245,158,11,.24), rgba(236,72,153,.16)); border-color: rgba(245,158,11,.4); }
.podium .pod.p2 { background: linear-gradient(160deg, rgba(148,163,184,.24), rgba(99,102,241,.12)); }
.podium .pod.p3 { background: linear-gradient(160deg, rgba(217,119,6,.2), rgba(139,92,246,.12)); }
.podium .pod .p-av { width: 54px; height: 54px; border-radius: 50%; background: var(--grad); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 20px; margin: 0 auto 8px; }
.podium .pod .p-nama { font-size: 13px; font-weight: 700; }
.podium .pod .p-poin { font-size: 12px; color: var(--muted); }

/* ======================= E-READER ======================= */
.reader-wrap { display: grid; grid-template-columns: 1fr 300px; gap: 20px; align-items: start; }
.reader-panel { background: rgba(255,255,255,.62); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; }
.reader-toolbar { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; background: rgba(255,255,255,.6); }
.reader-toolbar .spacer { flex: 1; }
.reader-stage { padding: 16px; min-height: 420px; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.reader-stage canvas { max-width: 100%; height: auto; border-radius: 10px; box-shadow: 0 10px 30px rgba(31,27,58,.16); }
.reader-teks { width: 100%; max-width: 760px; font-size: 17px; line-height: 1.85; white-space: pre-wrap; word-wrap: break-word; }
.reader-side { display: flex; flex-direction: column; gap: 16px; }
.reader-daftar { max-height: 260px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; }
.reader-daftar a, .reader-daftar span { display: flex; gap: 8px; padding: 6px 9px; border-radius: 9px; }
.reader-daftar a:hover { background: rgba(99,102,241,.1); }
.reader-hitam { background: #14122A !important; }
.reader-hitam .reader-stage, .reader-hitam .reader-teks { background: #14122A; color: #E6E3F5; }
.reader-hitam .reader-toolbar, .reader-hitam .reader-panel { background: #1D1A38; color: #E6E3F5; border-color: rgba(255,255,255,.12); }
body.reader-sepia .reader-stage { background: #F6ECD9; }
.reader-teks ::selection { background: rgba(139,92,246,.35); }

/* ======================= KIOSK ======================= */
.kiosk-body { display: grid; place-items: center; min-height: 100vh; padding: 20px; }
.kiosk-card { width: 100%; max-width: 720px; text-align: center; }
.kiosk-hasil { font-size: 22px; font-weight: 800; margin-top: 16px; min-height: 34px; }
.kiosk-ok { color: #047857; }
.kiosk-err { color: #b91c1c; }
video.kamera { width: 100%; max-width: 460px; border-radius: 16px; background: #1F1B3A; }
.scan-box { position: relative; display: inline-block; }
.scan-frame { position: absolute; inset: 12%; border: 3px solid rgba(255,255,255,.9); border-radius: 16px; box-shadow: 0 0 0 9999px rgba(31,27,58,.35); pointer-events: none; }

/* ======================= LOGIN ======================= */
.login-body { display: grid; place-items: center; min-height: 100vh; padding: 26px; }
.login-card {
  width: 100%; max-width: 430px; background: var(--glass-strong);
  backdrop-filter: blur(26px) saturate(180%); -webkit-backdrop-filter: blur(26px) saturate(180%);
  border: 1px solid var(--border); border-radius: 22px; box-shadow: 0 20px 60px rgba(79,70,229,.18);
  padding: 34px 30px;
}
.login-head { text-align: center; margin-bottom: 22px; }
.login-logo { width: 66px; height: 66px; border-radius: 18px; background: var(--grad); color: #fff; display: grid; place-items: center; font-size: 28px; font-weight: 800; margin: 0 auto 14px; box-shadow: 0 12px 28px rgba(99,102,241,.35); }
.login-logo-img { width: 68px; height: 68px; object-fit: contain; background: #fff; border-radius: 18px; padding: 8px; margin: 0 auto 14px; display: block; border: 1px solid var(--border); }
.login-title { font-size: 19px; font-weight: 800; letter-spacing: -.3px; }
.login-sub { font-size: 12.5px; color: var(--muted); }
.login-foot { text-align: center; font-size: 11.5px; color: var(--muted); margin-top: 18px; }
.login-role { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 10px; }
.login-role span { font-size: 11px; font-weight: 600; color: var(--muted); background: rgba(255,255,255,.6); border: 1px solid var(--line); border-radius: 9px; padding: 6px 8px; text-align: center; }

/* ======================= TAB ======================= */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.tabs a { padding: 9px 15px; border-radius: 11px 11px 0 0; font-size: 13px; font-weight: 600; color: var(--muted); }
.tabs a:hover { background: rgba(99,102,241,.08); color: var(--primary); }
.tabs a.active { background: var(--glass-strong); color: var(--primary); border: 1px solid var(--border); border-bottom-color: transparent; margin-bottom: -1px; }

/* ======================= KARTU ANGGOTA (cetak) ======================= */
.kartu-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6mm; justify-items: center; }
.kartu {
  width: 85.6mm; height: 54mm; border-radius: 4mm; padding: 4mm; display: flex; gap: 3mm;
  background: linear-gradient(135deg, #4F46E5, #8B5CF6); color: #fff;
  box-shadow: 0 2mm 4mm rgba(79,70,229,.28); break-inside: avoid; page-break-inside: avoid; position: relative; overflow: hidden;
}
.kartu::after { content: ''; position: absolute; right: -12mm; bottom: -18mm; width: 46mm; height: 46mm; border-radius: 50%; background: rgba(255,255,255,.12); }
.kartu-qr { width: 34mm; height: 34mm; background: #fff; border-radius: 3mm; padding: 1.5mm; flex: 0 0 auto; display: grid; place-items: center; }
.kartu-qr img, .kartu-qr canvas { width: 31mm; height: 31mm; }
.kartu-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.kartu-brand { font-size: 2.6mm; font-weight: 700; letter-spacing: .04em; opacity: .95; }
.kartu-sekolah { font-size: 2.5mm; opacity: .85; margin-bottom: 1.6mm; }
.kartu-nama { font-size: 4mm; font-weight: 800; line-height: 1.2; }
.kartu-row { font-size: 2.7mm; opacity: .95; }
.kartu-id { font-family: 'Courier New', monospace; font-size: 2.5mm; margin-top: auto; font-weight: 700; letter-spacing: .04em; }
.label-qr {
  width: 50mm; border: 1px dashed #94A3B8; border-radius: 3mm; padding: 3mm; text-align: center; background: #fff;
  break-inside: avoid; page-break-inside: avoid;
}
.label-qr .lq { width: 32mm; height: 32mm; margin: 0 auto; }
.label-qr .lq img, .label-qr .lq canvas { width: 32mm; height: 32mm; }
.label-qr .lt { font-size: 2.7mm; font-weight: 700; margin-top: 1.5mm; line-height: 1.25; }
.label-qr .lc { font-size: 2.4mm; color: #475569; font-family: 'Courier New', monospace; }

/* ======================= QR POSTER ======================= */
.poster { max-width: 620px; margin: 0 auto; text-align: center; background: #fff; border-radius: 20px; padding: 32px; box-shadow: var(--shadow); }
.poster .po-qr { width: 300px; height: 300px; margin: 18px auto; }
.poster .po-qr img, .poster .po-qr canvas { width: 300px; height: 300px; }
.poster h3 { font-size: 24px; }


/* ======================= GRID ADAPTIF (aman di layar kecil) ======================= */
.grid-aside    { grid-template-columns: 340px minmax(0, 1fr); }
.grid-aside-sm { grid-template-columns: 320px minmax(0, 1fr); }
.grid-side     { grid-template-columns: minmax(0, 1fr) 380px; }
.grid-side-wide{ grid-template-columns: minmax(0, 1fr) 420px; }
.grid-lebar    { grid-template-columns: 420px minmax(0, 1fr); }
.grid-2-1      { grid-template-columns: 1.15fr .85fr; }
.grid-rapat    { gap: 14px; }
@media (max-width: 1100px) {
  .grid-aside, .grid-aside-sm, .grid-side, .grid-side-wide, .grid-lebar, .grid-2-1 { grid-template-columns: minmax(0, 1fr); }
}

/* Item grid harus boleh menyusut — tanpa ini tabel/kolom lebar memaksa halaman melebar di HP */
.grid > *, .grid-buku > *, .form-grid > *, .form-grid-3 > *, .detail-grid > *, .reader-wrap > * { min-width: 0; }
.field input, .field select, .field textarea { min-width: 0; }
.table-wrap { max-width: 100%; }
.card { overflow-wrap: anywhere; }


/* ======================= FOOTER APLIKASI (credit NEXA MASANEGAYA) ======================= */
/* Disamakan dengan aplikasi NEXA lain: dua baris — nama platform & tahun + instansi + pembuat */
.app-footer {
  margin: 0 30px 26px; padding: 14px 0 0;
  border-top: 1px solid var(--line);
  text-align: center; font-size: 11px; line-height: 1.6; color: var(--muted);
}
.app-footer .af-line { font-weight: 600; }
.app-footer .af-line:first-child { font-weight: 700; }
.login-brand-foot { text-align: center; margin-top: 16px; font-size: 11.5px; line-height: 1.6; color: var(--muted); font-weight: 600; }
@media (max-width: 860px) { .app-footer { margin: 0 16px 22px; } }

/* ======================= RESPONSIF ======================= */
@media (max-width: 1100px) {
  .detail-grid-3 { grid-template-columns: repeat(2, 1fr); }
  .reader-wrap { grid-template-columns: 1fr; }
}
@media (max-width: 980px) {
  .grid-4, .grid-5 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .form-grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 860px) {
  .sidebar { transform: translateX(-100%); box-shadow: 0 0 40px rgba(31,27,58,.3); }
  body.sidebar-open .sidebar { transform: none; }
  .main { margin-left: 0; }
  .hamburger { display: block; }
  .content { padding: 18px 16px 54px; }
  .grid-2, .grid-3, .grid-4, .grid-5 { grid-template-columns: 1fr; }
  .form-grid, .form-grid-3, .detail-grid, .detail-grid-3 { grid-template-columns: 1fr; }
  .podium { grid-template-columns: 1fr; }
  .kartu-grid { grid-template-columns: 1fr; }
  .topbar { padding: 0 14px; }
  .topbar h1 { font-size: 15px; }
  .card { padding: 18px 16px; }
  .field input, .field select, .field textarea { font-size: 16px; }
}
@media (max-width: 520px) {
  .stat b { font-size: 19px; }
  .stat-ico { width: 38px; height: 38px; font-size: 17px; }
  .grid-buku { grid-template-columns: repeat(2, 1fr); gap: 14px; }
  .buku-judul { font-size: 12.5px; }
}

/* ======================= CETAK ======================= */
@media print {
  body { background: #fff !important; }
  .sidebar, .topbar, .no-print, .tabs, .flash, .actions-row { display: none !important; }
  .main { margin-left: 0 !important; }
  .content { padding: 0 !important; max-width: none !important; }
  .card { box-shadow: none; border: 1px solid #ddd; backdrop-filter: none; background: #fff; break-inside: avoid; }
  table.tbl th, table.tbl td { white-space: normal; }
  .table-wrap { overflow: visible; }
}
