/* =========================================================
   PB SMEKMA — tema "Lapangan Indoor"
   Biru matras lapangan, garis putih, aksen gabus kok (amber)
   ========================================================= */
:root {
    --court: #16348C;
    --court-deep: #0C1F5C;
    --court-soft: #E8EDFA;
    --cork: #F2A93B;
    --cork-soft: #FDF1DC;
    --ink: #172036;
    --muted: #66708A;
    --paper: #F4F6FB;
    --line: #E1E6F0;
    --rally: #188A5E;
    --rally-soft: #E1F4EC;
    --smash: #D63B3B;
    --smash-soft: #FBE6E6;
    --radius-lg: 22px;
    --radius: 14px;
    --radius-sm: 10px;
    --bs-body-font-family: 'Lexend', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --bs-primary: #16348C;
    --bs-primary-rgb: 22, 52, 140;
    --bs-link-color: #16348C;
    --bs-link-hover-color: #0C1F5C;
}

[data-bs-theme="dark"] {
    --court-soft: #1B2647;
    --cork-soft: #3A2E17;
    --ink: #E6EAF4;
    --muted: #98A2BC;
    --paper: #0F1526;
    --line: #26304A;
    --rally-soft: #12352A;
    --smash-soft: #3D1C1F;
    --bs-link-color: #9DB3F5;
    --bs-body-bg: #141B2F;
    --bs-tertiary-bg: #0F1526;
}

body {
    font-family: var(--bs-body-font-family);
    color: var(--ink);
    font-weight: 400;
    letter-spacing: -.005em;
}
body.bg-body-tertiary { background: var(--paper) !important; }
.tnum { font-variant-numeric: tabular-nums; }
a { text-decoration: none; }
:focus-visible { outline: 3px solid var(--cork); outline-offset: 2px; }

/* ---------- Header ---------- */
.app-header { border-bottom: 1px solid var(--line); box-shadow: none !important; }
.mobile-brand { display: flex; align-items: center; gap: .55rem; color: var(--ink); font-weight: 600; padding-left: .25rem; }
.mobile-brand img { width: 32px; height: 32px; border-radius: 9px; object-fit: cover; }
.mobile-brand span { max-width: 52vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .95rem; }
.btn-tema { background: none; border: 0; }
.user-menu .dropdown-toggle::after { display: none; }

/* ---------- Sidebar: matras lapangan ---------- */
.app-sidebar {
    background: var(--court) !important;
    position: relative;
}
.app-sidebar .sidebar-brand { border-bottom: 1px solid rgba(255, 255, 255, .12); height: 64px; }
.app-sidebar .brand-link { display: flex; align-items: center; gap: .65rem; }
.app-sidebar .brand-image { width: 36px; height: 36px; border-radius: 10px; object-fit: cover; box-shadow: none !important; margin: 0 !important; float: none !important; max-height: none; }
.app-sidebar .brand-text { font-weight: 600 !important; font-size: 1rem; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-menu .nav-header { color: rgba(255, 255, 255, .5) !important; font-size: .72rem; font-weight: 500; letter-spacing: .02em; padding-top: 1.1rem; }
.sidebar-menu .nav-link { color: rgba(255, 255, 255, .78) !important; border-radius: 10px; margin: 2px 10px; position: relative; font-weight: 400; }
.sidebar-menu .nav-link:hover { background: rgba(255, 255, 255, .08) !important; color: #fff !important; }
.sidebar-menu .nav-link.active {
    background: rgba(255, 255, 255, .14) !important;
    color: #fff !important;
    font-weight: 500;
    box-shadow: inset 3px 0 0 var(--cork);
}
.sidebar-menu .nav-link.active .nav-icon { color: var(--cork); }
/* Garis lapangan di dasar sidebar */
.sidebar-court {
    position: absolute; left: 22px; right: 22px; bottom: 24px; height: 150px;
    border: 2px solid rgba(255, 255, 255, .13); border-radius: 2px; pointer-events: none;
    background:
        linear-gradient(rgba(255,255,255,.13), rgba(255,255,255,.13)) center 50% / 100% 2px no-repeat,
        linear-gradient(rgba(255,255,255,.13), rgba(255,255,255,.13)) center 32% / 100% 2px no-repeat,
        linear-gradient(rgba(255,255,255,.13), rgba(255,255,255,.13)) center 68% / 100% 2px no-repeat,
        linear-gradient(rgba(255,255,255,.13), rgba(255,255,255,.13)) 50% center / 2px 64% no-repeat;
}
.sidebar-court::before, .sidebar-court::after {
    content: ""; position: absolute; top: 0; bottom: 0; width: 2px; background: rgba(255, 255, 255, .13);
}
.sidebar-court::before { left: 9%; }
.sidebar-court::after { right: 9%; }
@media (max-height: 720px) { .sidebar-court { display: none; } }

/* ---------- Judul halaman ---------- */
.app-content-header { padding: 1.4rem .5rem .6rem; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; }
.page-title { font-size: 1.6rem; font-weight: 600; letter-spacing: -.02em; margin: 0; }
.page-sub { color: var(--muted); margin: .2rem 0 0; font-size: .92rem; }
.page-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

/* ---------- Panel ---------- */
.panel {
    background: var(--bs-body-bg);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    margin-bottom: 1.25rem;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: 1rem 1.25rem; border-bottom: 1px solid var(--line); }
.panel-head h2, .panel-head h3 { font-size: 1rem; font-weight: 600; margin: 0; }
.panel-head .sub { color: var(--muted); font-size: .8rem; }
.panel-body { padding: 1.25rem; }
.panel-flush .list-row:last-child { border-bottom: 0; }

/* ---------- Papan skor (dashboard) ---------- */
.scoreboard {
    background: var(--court-deep);
    color: #fff;
    border-radius: var(--radius-lg);
    padding: 1.6rem 1.75rem;
    position: relative;
    overflow: hidden;
    margin-bottom: 1.25rem;
    display: grid;
    grid-template-columns: 1.35fr 1fr;
    gap: 1.5rem;
}
.scoreboard::before { /* garis servis samar */
    content: ""; position: absolute; inset: 14px; border: 1.5px solid rgba(255, 255, 255, .08); border-radius: 12px; pointer-events: none;
}
.scoreboard .sb-main { position: relative; }
.sb-label { font-size: .85rem; color: rgba(255, 255, 255, .7); }
.sb-big { font-size: clamp(2.1rem, 5vw, 3.2rem); font-weight: 600; letter-spacing: -.03em; line-height: 1.05; margin: .35rem 0 .5rem; font-variant-numeric: tabular-nums; }
.sb-big small { font-size: .45em; font-weight: 400; color: rgba(255, 255, 255, .6); margin-right: .25rem; }
.sb-note { font-size: .85rem; color: rgba(255, 255, 255, .75); }
.sb-note .up { color: #7FE0B4; }
.sb-note .down { color: #FFB1B1; }
.sb-stats { position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: .9rem; border-left: 2px dashed rgba(255, 255, 255, .22); padding-left: 1.5rem; }
.sb-stat .v { font-size: 1.5rem; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.15; }
.sb-stat .v.cork { color: var(--cork); }
.sb-stat .l { font-size: .78rem; color: rgba(255, 255, 255, .65); }
@media (max-width: 767.98px) {
    .scoreboard { grid-template-columns: 1fr; padding: 1.35rem; border-radius: 18px; }
    .sb-stats { border-left: 0; border-top: 2px dashed rgba(255, 255, 255, .22); padding: 1rem 0 0; }
}

/* Cincin pelunasan */
.ring { --p: 0; width: 132px; height: 132px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto;
    background: conic-gradient(var(--rally) calc(var(--p) * 1%), var(--line) 0); }
.ring > div { width: 104px; height: 104px; border-radius: 50%; background: var(--bs-body-bg); display: grid; place-items: center; text-align: center; }
.ring b { font-size: 1.6rem; font-weight: 600; display: block; line-height: 1; }
.ring span { font-size: .72rem; color: var(--muted); }

/* ---------- Baris daftar ---------- */
.list-row { display: flex; align-items: center; gap: .85rem; padding: .85rem 1.25rem; border-bottom: 1px solid var(--line); }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .t1 { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-row .t2 { font-size: .8rem; color: var(--muted); }
.list-row .amt { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- Avatar ---------- */
.avatar { border-radius: 50%; object-fit: cover; flex-shrink: 0; display: inline-block; }
.avatar-init { display: inline-grid; place-items: center; background: var(--court-soft); color: var(--court); font-weight: 600; }
[data-bs-theme="dark"] .avatar-init { color: #AFC0F2; }

/* ---------- Status ---------- */
.pill { display: inline-flex; align-items: center; gap: .35rem; padding: .28rem .65rem; border-radius: 999px; font-size: .76rem; font-weight: 500; white-space: nowrap; }
.pill-lunas { background: var(--rally-soft); color: var(--rally); }
.pill-belum { background: var(--cork-soft); color: #9A5F05; }
.pill-telat { background: var(--smash-soft); color: var(--smash); }
.pill-aktif { background: var(--rally-soft); color: var(--rally); }
.pill-nonaktif { background: var(--line); color: var(--muted); }
[data-bs-theme="dark"] .pill-belum { color: var(--cork); }

/* ---------- Tombol ---------- */
.btn { border-radius: 10px; font-weight: 500; }
.btn-primary { --bs-btn-bg: var(--court); --bs-btn-border-color: var(--court); --bs-btn-hover-bg: var(--court-deep); --bs-btn-hover-border-color: var(--court-deep); --bs-btn-active-bg: var(--court-deep); }
.btn-cork { background: var(--cork); color: #3B2600; border: 0; }
.btn-cork:hover { background: #E59A25; color: #3B2600; }
.btn-wa { background: #1FAF54; color: #fff; border: 0; }
.btn-wa:hover { background: #18913F; color: #fff; }
.btn-soft { background: var(--court-soft); color: var(--court); border: 0; }
.btn-soft:hover { background: var(--court); color: #fff; }
[data-bs-theme="dark"] .btn-soft { color: #AFC0F2; }
.btn-icon { width: 34px; height: 34px; padding: 0; display: inline-grid; place-items: center; border-radius: 9px; }

/* ---------- Formulir ---------- */
.form-control, .form-select { border-radius: 10px; border-color: var(--line); padding: .6rem .85rem; }
.form-control:focus, .form-select:focus { border-color: var(--court); box-shadow: 0 0 0 .2rem rgba(22, 52, 140, .15); }
.form-label { font-weight: 500; font-size: .87rem; margin-bottom: .35rem; }
.form-text { font-size: .78rem; }
.input-group-text { border-color: var(--line); border-radius: 10px; background: var(--paper); }
.req::after { content: " *"; color: var(--smash); }
.form-section { font-weight: 600; font-size: .95rem; margin: 0 0 1rem; display: flex; align-items: center; gap: .5rem; }
.form-section i { color: var(--court); }

/* ---------- Tabel ---------- */
.table-wrap { overflow-x: auto; }
.table-club { margin: 0; --bs-table-bg: transparent; }
.table-club thead th { font-size: .78rem; font-weight: 500; color: var(--muted); background: var(--paper); border-bottom: 1px solid var(--line); padding: .7rem 1rem; white-space: nowrap; }
.table-club td { padding: .8rem 1rem; vertical-align: middle; border-color: var(--line); }
.table-club tbody tr:hover { background: rgba(22, 52, 140, .03); }
.cell-person { display: flex; align-items: center; gap: .7rem; min-width: 200px; }
.cell-person .n { font-weight: 500; color: var(--ink); }
.cell-person .s { font-size: .78rem; color: var(--muted); }
.aksi { display: flex; gap: .35rem; justify-content: flex-end; flex-wrap: nowrap; }

/* Tabel menjadi kartu di ponsel */
@media (max-width: 767.98px) {
    .table-mobile thead { display: none; }
    .table-mobile, .table-mobile tbody, .table-mobile tr, .table-mobile td { display: block; width: 100%; }
    .table-mobile tr { border-bottom: 8px solid var(--paper); padding: .85rem 1rem; }
    .table-mobile td { border: 0; padding: .3rem 0; display: flex; justify-content: space-between; align-items: center; gap: 1rem; text-align: right; }
    .table-mobile td::before { content: attr(data-label); color: var(--muted); font-size: .78rem; text-align: left; flex-shrink: 0; }
    .table-mobile td.td-main { display: block; text-align: left; padding-bottom: .55rem; }
    .table-mobile td.td-main::before { display: none; }
    .table-mobile td.td-aksi { padding-top: .6rem; }
    .table-mobile td.td-aksi::before { display: none; }
    .table-mobile td.td-aksi .aksi { width: 100%; justify-content: flex-start; flex-wrap: wrap; }
}

/* ---------- Filter bar ---------- */
.filter-bar { display: flex; gap: .6rem; flex-wrap: wrap; padding: 1rem 1.25rem; border-bottom: 1px solid var(--line); }
.filter-bar .search { flex: 1 1 220px; position: relative; }
.filter-bar .search i { position: absolute; left: .85rem; top: 50%; transform: translateY(-50%); color: var(--muted); }
.filter-bar .search input { padding-left: 2.3rem; }
.filter-bar .form-select { width: auto; flex: 0 1 170px; }

.chips { display: flex; gap: .5rem; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: .4rem; padding: .45rem .85rem; border-radius: 999px; border: 1px solid var(--line); color: var(--ink); font-size: .84rem; background: var(--bs-body-bg); }
.chip b { font-variant-numeric: tabular-nums; }
.chip.active { background: var(--court); border-color: var(--court); color: #fff; }

/* ---------- Kosong ---------- */
.empty { text-align: center; padding: 2.5rem 1.25rem; color: var(--muted); }
.empty i { font-size: 2.2rem; color: var(--court); opacity: .5; display: block; margin-bottom: .5rem; }
.empty p { max-width: 36ch; margin: 0 auto .9rem; }

/* ---------- Kartu anggota (ciri khas) ---------- */
.member-card {
    width: 100%; max-width: 420px; aspect-ratio: 85.6 / 54;
    border-radius: 18px; color: #fff; position: relative; overflow: hidden;
    background: var(--court);
    padding: 6% 6.5%;
    display: flex; flex-direction: column; justify-content: space-between;
    box-shadow: 0 18px 40px -18px rgba(12, 31, 92, .65);
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.member-card .mc-court { position: absolute; inset: 0; opacity: .16; pointer-events: none; }
.member-card .mc-top { display: flex; align-items: center; gap: .6rem; position: relative; }
.member-card .mc-top img { width: 34px; height: 34px; border-radius: 9px; object-fit: cover; background: #fff; }
.member-card .mc-club { font-weight: 600; font-size: .95rem; line-height: 1.15; }
.member-card .mc-club small { display: block; font-weight: 300; font-size: .7rem; opacity: .75; }
.member-card .mc-body { display: flex; align-items: flex-end; justify-content: space-between; gap: .75rem; position: relative; }
.member-card .mc-name { font-size: 1.15rem; font-weight: 600; line-height: 1.2; letter-spacing: -.01em; }
.member-card .mc-no { font-variant-numeric: tabular-nums; font-size: .95rem; color: var(--cork); font-weight: 500; letter-spacing: .04em; margin-top: .15rem; }
.member-card .mc-meta { font-size: .68rem; opacity: .75; margin-top: .3rem; }
.member-card .mc-qr { background: #fff; padding: 5px; border-radius: 8px; flex-shrink: 0; line-height: 0; }
.member-card .mc-qr img, .member-card .mc-qr canvas { width: 70px !important; height: 70px !important; }
.member-card .mc-status { position: absolute; top: 6%; right: 6.5%; font-size: .66rem; padding: .2rem .55rem; border-radius: 99px; background: rgba(255,255,255,.16); }
.member-card.nonaktif { filter: grayscale(.85); }

/* ---------- Hero anggota ---------- */
.hello { display: grid; grid-template-columns: minmax(0, 420px) 1fr; gap: 1.5rem; align-items: center; margin-bottom: 1.25rem; }
.due-box { background: var(--bs-body-bg); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 1.5rem; }
.due-box .amt { font-size: 2rem; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.due-box.clear .amt { color: var(--rally); }
.due-box.owe .amt { color: var(--smash); }
@media (max-width: 991.98px) { .hello { grid-template-columns: 1fr; } .member-card { margin: 0 auto; } }

/* ---------- Profil anggota ---------- */
.profile-hero { display: flex; gap: 1.25rem; align-items: center; padding: 1.5rem 1.25rem; flex-wrap: wrap; }
.profile-hero .nm { font-size: 1.35rem; font-weight: 600; letter-spacing: -.01em; }
.info-list { margin: 0; }
.info-list > div { display: flex; justify-content: space-between; gap: 1rem; padding: .7rem 1.25rem; border-bottom: 1px solid var(--line); }
.info-list > div:last-child { border-bottom: 0; }
.info-list dt { font-weight: 400; color: var(--muted); font-size: .86rem; }
.info-list dd { margin: 0; font-weight: 500; text-align: right; }

/* ---------- Navigasi bawah ---------- */
.bottom-nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 1040;
    display: grid; grid-template-columns: repeat(5, 1fr); align-items: end;
    background: var(--bs-body-bg);
    border-top: 1px solid var(--line);
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    box-shadow: 0 -8px 24px -16px rgba(12, 31, 92, .35);
}
.bottom-nav a { display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--muted); padding: 4px 0; font-size: .68rem; }
.bottom-nav .bn-item i { font-size: 1.3rem; line-height: 1; }
.bottom-nav .bn-item.active { color: var(--court); font-weight: 500; }
[data-bs-theme="dark"] .bottom-nav .bn-item.active { color: #AFC0F2; }
.bn-fab-btn {
    width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center;
    background: var(--court); color: #fff; font-size: 1.45rem; margin-top: -30px;
    border: 5px solid var(--bs-body-bg); box-shadow: 0 8px 18px -6px rgba(22, 52, 140, .6);
    transition: transform .15s ease;
}
.bn-fab:active .bn-fab-btn { transform: scale(.94); }
.bn-fab.active .bn-fab-btn { background: var(--cork); color: #3B2600; }
.bn-fab .bn-label { color: var(--ink); font-weight: 500; }
@media (max-width: 991.98px) {
    body { padding-bottom: calc(78px + env(safe-area-inset-bottom)); }
    .app-footer { display: none; }
    .app-content-header { padding-top: 1rem; }
    .page-title { font-size: 1.35rem; }
}

/* ---------- SweetAlert selaras tema ---------- */
.swal2-popup { font-family: var(--bs-body-font-family) !important; border-radius: 18px !important; }
.swal2-styled.swal2-confirm { background: var(--court) !important; border-radius: 10px !important; }
.swal2-styled.swal2-cancel { border-radius: 10px !important; }

/* Halaman masuk memakai assets/css/login.css */

/* ---------- Gerak ---------- */
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- Cetak ---------- */
@media print {
    .app-header, .app-sidebar, .bottom-nav, .app-footer, .no-print, .page-actions, .filter-bar { display: none !important; }
    .app-main { margin: 0 !important; }
    body { padding: 0 !important; background: #fff !important; }
    .panel { border: 0; }
    .app-wrapper { display: block !important; }
}
