/* ===============================
   Hafalan Qur'an — Style Utama
   Tema: Monokrom putih bermotif (refined)
   =============================== */

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg: #FFFFFF;
    --pattern: #EEEEEE;
    --text-utama: #1A1A1A;
    --text-terjemah: #555555;
    --text-sekunder: #999999;
    --border: #E5E5E5;
    --tombol-aktif: #000000;
    --tombol-hover: #333333;
    --accent-soft: rgba(0, 0, 0, 0.04);
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
    --shadow-lg: 0 12px 32px rgba(0,0,0,0.08);
    --font-arab: 'Amiri Quran', 'Scheherazade New', 'Noto Naskh Arabic', 'Lateef', serif;
}

html {
    scroll-behavior: smooth;
    /* ✨ Prevent horizontal overflow & adjust text size on iOS */
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
    text-size-adjust: 100%;
    /* Disable pull-to-refresh & overscroll */
    overscroll-behavior-x: none;
}

body {
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    background-color: var(--bg);
    background-image: url('../img/pattern.jpeg');
    background-repeat: repeat;
    background-size: 320px 320px;
    color: var(--text-utama);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    /* ✨ Prevent horizontal overflow & body scroll bug */
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
    position: relative;
    /* iOS Safari: prevent rubber-band scrolling */
    overscroll-behavior-x: none;
    /* Disable double-tap zoom */
    touch-action: pan-y;
}

/* Container utama */
.container {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 0 1.5rem;
    box-sizing: border-box;
}

main {
    flex: 1;
    padding: 2rem 0 2.5rem;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

/* ========== Navbar ========== */
.navbar {
    background-color: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 1.5rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    text-decoration: none;
    color: var(--text-utama);
    font-weight: 700;
    font-size: 1.05rem;
    flex-shrink: 0;
}

.logo-img {
    height: 44px;
    width: auto;
    max-width: 55px;
    object-fit: contain;
    display: block;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
    list-style: none;
    margin: 0 auto;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-terjemah);
    font-size: 0.95rem;
    font-weight: 500;
    transition: color 0.2s ease;
    position: relative;
    padding: 0.35rem 0.15rem;
}

.nav-links a:hover {
    color: var(--tombol-aktif);
}

.nav-links a.active {
    color: var(--tombol-aktif);
    font-weight: 600;
}

.nav-links a.active::after {
    content: '';
    position: absolute;
    bottom: -0.6rem;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--tombol-aktif);
    border-radius: 2px;
}

/* Tombol Auth kompak di navbar */
.nav-auth {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-shrink: 0;
}

.nav-auth-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.4rem 0.85rem;
    font-size: 0.82rem;
    font-weight: 600;
    border-radius: 999px;
    border: 1px solid var(--tombol-aktif);
    background: transparent;
    color: var(--tombol-aktif);
    cursor: pointer;
    text-decoration: none;
    transition: all 0.18s ease;
    line-height: 1;
    white-space: nowrap;
    font-family: inherit;
}

.nav-auth-btn:hover {
    background: var(--tombol-aktif);
    color: #fff;
    transform: translateY(-1px);
}

.nav-auth-btn.primary {
    background: var(--tombol-aktif);
    color: #fff;
}

.nav-auth-btn.primary:hover {
    background: var(--tombol-hover);
    border-color: var(--tombol-hover);
}

.nav-user-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.75rem;
    background: var(--accent-soft);
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-utama);
    max-width: 200px;
}

.nav-user-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 110px;
}

.nav-user-logout {
    background: transparent;
    border: none;
    cursor: pointer;
    color: #cc3333;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0;
    margin-left: 0.15rem;
    text-decoration: none;
    line-height: 1;
}

.nav-user-logout:hover {
    text-decoration: underline;
}

/* ========== Tipografi ========== */
h1, h2, h3, h4 {
    color: var(--text-utama);
    line-height: 1.25;
    margin-bottom: 1rem;
    font-weight: 700;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.1rem; }

p {
    margin-bottom: 1rem;
    color: var(--text-terjemah);
}

a {
    color: var(--tombol-aktif);
    text-decoration: underline;
    text-underline-offset: 3px;
}

a:hover {
    color: var(--tombol-hover);
}

/* ========== Tombol ========== */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background-color: var(--tombol-aktif);
    color: #FFFFFF;
    text-decoration: none;
    border: 1px solid var(--tombol-aktif);
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    transition: background-color 0.2s ease, transform 0.1s ease;
}

.btn:hover {
    background-color: var(--tombol-hover);
    color: #FFFFFF;
    border-color: var(--tombol-hover);
}

.btn:active {
    transform: scale(0.98);
}

.btn-outline {
    background-color: transparent;
    color: var(--tombol-aktif);
    border: 1px solid var(--tombol-aktif);
}

.btn-outline:hover {
    background-color: var(--tombol-aktif);
    color: #FFFFFF;
}

.btn-primary {
    background: var(--tombol-aktif);
    color: #fff;
}

/* ========== Card ========== */
.card {
    background-color: rgba(255, 255, 255, 0.92);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* ========== Form ========== */
select, input[type="text"], input[type="number"], input[type="search"] {
    width: 100%;
    padding: 0.7rem 1rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 1rem;
    font-family: inherit;
    background-color: #FFFFFF;
    color: var(--text-utama);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

select:focus, input:focus {
    outline: none;
    border-color: var(--tombol-aktif);
    box-shadow: 0 0 0 3px rgba(0,0,0,0.06);
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-utama);
    font-size: 0.95rem;
}

/* ========== SAS PEDULI Hero Brand ========== */
.sas-brand {
    text-align: center;
    padding: 2rem 0 0;       /* padding bawah dipindah ke margin supaya konsisten */
    margin-bottom: 1.5rem;   /* ✨ jarak konsisten antar section beranda */
}

.sas-brand-title {
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    margin-bottom: 0.35rem;
    color: var(--text-utama);
    line-height: 1.1;
}

.sas-brand-tagline {
    font-size: 1rem;
    color: var(--text-terjemah);
    margin-bottom: 1.25rem;
    font-weight: 500;
    letter-spacing: 0.04em;
}

.sas-brand-bismillah {
    font-family: var(--font-arab);
    font-size: 2.4rem;
    line-height: 1.4;
    color: var(--text-utama);
    direction: rtl;
    margin-top: 0.5rem;
    margin-bottom: 0;
}

/* ========== Interest Bars (Mau ... ) ========== */
.interest-section {
    margin-bottom: 2rem;
}

.interest-section-title {
    font-size: 0.9rem;
    text-align: center;
    color: var(--text-sekunder);
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 600;
}

.interest-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.9rem 1.1rem;
    margin-bottom: 0.6rem;
    transition: all 0.2s ease;
}

.interest-bar:hover {
    border-color: var(--text-terjemah);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.interest-bar-label {
    flex: 1;
    min-width: 0;
    color: var(--text-utama);
    font-size: 0.95rem;
    font-weight: 500;
    line-height: 1.35;
}

.interest-bar-label small {
    display: block;
    color: var(--text-sekunder);
    font-size: 0.78rem;
    font-weight: 400;
    margin-top: 0.15rem;
}

/* Toggle switch style "Mau" */
.interest-toggle {
    flex-shrink: 0;
    position: relative;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
}

.interest-toggle input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.interest-toggle-box {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 64px;
    padding: 0.45rem 0.85rem;
    border: 1.5px solid var(--text-utama);
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-utama);
    background: transparent;
    transition: all 0.2s ease;
    user-select: none;
    line-height: 1;
}

.interest-toggle:hover .interest-toggle-box {
    background: var(--accent-soft);
}

.interest-toggle input:checked + .interest-toggle-box {
    background: var(--text-utama);
    color: #fff;
    border-color: var(--text-utama);
}

.interest-toggle input:checked + .interest-toggle-box::before {
    content: '✓ ';
}

/* Saat user belum login dan klik Mau */
.interest-toggle.is-loading .interest-toggle-box {
    opacity: 0.6;
    pointer-events: none;
}

.interest-bar.is-saved {
    background: rgba(0, 0, 0, 0.02);
    border-color: var(--text-utama);
}

/* ========== Hero / Intro lama (tetap ada untuk page lain kalau dipakai) ========== */
.hero {
    text-align: center;
    padding: 3rem 0 2rem;
}

.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
}

.hero p {
    font-size: 1.1rem;
    max-width: 540px;
    margin: 0 auto 1.5rem;
}

/* ========== Footer ========== */
.footer {
    border-top: 1px solid var(--border);
    padding: 1.5rem 0;
    text-align: center;
    background-color: rgba(255, 255, 255, 0.9);
}

.footer p {
    color: var(--text-sekunder);
    font-size: 0.875rem;
    margin: 0;
}

/* ========== Utility ========== */
.text-center { text-align: center; }
.text-muted { color: var(--text-sekunder); }
.text-arab {
    font-family: var(--font-arab);
    direction: rtl;
    font-size: 2rem;
    line-height: 2.2;
    color: var(--text-utama);
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

/* ========== Mobile (≤ 640px) ========== */
@media (max-width: 640px) {
    /* ✨ Navbar FIXED di mobile — logo & hamburger selalu visible saat scroll
       Pakai fixed (bukan sticky) supaya reliable di iOS Safari & PWA standalone.
       Space untuk navbar di-handle oleh padding-top main di bagian bawah file. */
    .navbar {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        width: 100%;
    }

    .container {
        padding: 0 1rem;
    }
    
    .nav-inner {
        padding: 0.55rem 0.875rem;
        gap: 0.5rem;
    }
    
    .logo {
        gap: 0.45rem;
    }
    
    .logo-img {
        height: 48px;       /* ✨ lebih besar di mobile */
        max-width: 58px;
    }
    
    .logo-text {
        font-size: 1rem;
        white-space: nowrap;
    }
    
    /* Hide nav-links & nav-auth di mobile, ganti dengan hamburger */
    .nav-links { display: none !important; }
    .nav-auth { display: none !important; }
    .nav-hamburger { display: inline-flex !important; }
    
    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.25rem; }
    .hero { padding: 2rem 0 1.5rem; }
    .hero h1 { font-size: 1.75rem; }
    .hero p { font-size: 1rem; }
    .text-arab { font-size: 1.6rem; }
    
    .sas-brand {
        padding: 1.5rem 0 0;
        margin-bottom: 1.5rem;
    }
    .sas-brand-title { font-size: 1.9rem; }
    .sas-brand-tagline { font-size: 0.9rem; }
    .sas-brand-bismillah { font-size: 1.9rem; }
    
    .interest-bar {
        padding: 0.75rem 0.9rem;
        gap: 0.65rem;
    }
    .interest-bar-label { font-size: 0.88rem; }
    .interest-bar-label small { font-size: 0.72rem; }
    .interest-toggle-box {
        min-width: 56px;
        padding: 0.4rem 0.7rem;
        font-size: 0.78rem;
    }
    
    .card {
        padding: 1.25rem 1rem;
    }
    
    main {
        /* padding-top 5rem dari atas → space untuk navbar fixed
           bottom 2rem → space untuk scroll terakhir */
        padding: 5rem 0 2rem;
    }
    
    .card + .card,
    .kontrol + .kontrol-aksi,
    .kontrol-aksi + .edisi-switcher,
    .edisi-switcher + .audio-controls,
    .audio-controls + .font-switcher,
    .font-switcher + .ayat-list,
    .card + .ayat-list {
        margin-top: 1rem;
    }
}

/* ========== Mobile sempit (≤ 460px) — logo text bisa muncul terus karena hamburger sudah hide nav ========== */
@media (max-width: 460px) {
    .logo-text {
        font-size: 0.95rem;
    }
}

/* ========== Mobile sangat sempit (≤ 380px) ========== */
@media (max-width: 380px) {
    .nav-inner {
        padding: 0.5rem 0.75rem;
        gap: 0.35rem;
    }
    
    .logo-img {
        height: 42px;
        max-width: 50px;
    }
    
    .logo-text {
        font-size: 0.88rem;
    }
}

/* ========== Auto-hide header pada landscape mobile ========== */
@media (max-height: 500px) and (orientation: landscape) {
    .header {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 100;
        transition: transform 0.3s ease;
        backdrop-filter: blur(10px);
        background: rgba(255, 255, 255, 0.95);
    }
    .header.hidden-on-scroll {
        transform: translateY(-100%);
    }
    body {
        padding-top: 55px;
    }
}

.search-result-item {
    display: block;
    padding: 0.75rem;
    border: 1px solid #eee;
    border-radius: 6px;
    margin-bottom: 0.5rem;
    text-decoration: none;
    color: inherit;
    transition: background 0.15s, border-color 0.15s;
}
.search-result-item:hover {
    background: rgba(0,0,0,0.03);
    border-color: var(--accent, #2d5a3f);
}

/* ===== Surah Picker (custom searchable list) ===== */
.surah-picker {
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}
.surah-search-input {
    width: 100%;
    padding: 0.7rem 0.9rem;
    border: none;
    border-bottom: 1px solid #eee;
    font-size: 1rem;
    outline: none;
}
.surah-search-input:focus {
    background: #fafafa;
}
.surah-selected {
    padding: 0.5rem 0.9rem;
    background: #fafafa;
    border-bottom: 1px solid #eee;
    color: var(--text-sekunder, #666);
    font-size: 0.88rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.surah-selected.has-selection {
    background: rgba(45, 90, 63, 0.08);
    color: var(--text-primer, #000);
    font-weight: 500;
}
.surah-selected small {
    color: var(--text-sekunder, #666);
    font-size: 0.8rem;
}
.surah-list {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 215px;
    overflow-y: auto;
}
.surah-list-loading,
.surah-list-empty {
    padding: 1rem;
    text-align: center;
    color: var(--text-sekunder, #666);
    font-size: 0.9rem;
}
.surah-item {
    padding: 0.6rem 0.9rem;
    cursor: pointer;
    border-bottom: 1px solid #f3f3f3;
    transition: background 0.12s;
    font-size: 0.95rem;
}
.surah-item:last-child {
    border-bottom: none;
}
.surah-item:hover {
    background: #f7f7f7;
}
.surah-item.is-match {
    background: rgba(255, 235, 100, 0.45);
    font-weight: 600;
}
.surah-item.is-selected {
    background: rgba(45, 90, 63, 0.12);
    color: var(--accent, #2d5a3f);
    font-weight: 600;
}
.surah-item.is-match.is-selected {
    background: linear-gradient(90deg, rgba(255,235,100,0.45), rgba(45,90,63,0.12));
}

/* Halaman Tentang */
.tentang-page { max-width: 760px; padding: 2rem 1.5rem; }
.tentang-hero {
    text-align: center;
    padding: 1.5rem 0 2rem;
    border-bottom: 1px solid #eee;
    margin-bottom: 2rem;
}
.tentang-logo { width: 90px; margin-bottom: 1rem; }
.tentang-hero h1 { font-size: 1.8rem; margin-bottom: 0.4rem; font-weight: 700; }
.tentang-tagline { color: #666; font-size: 1rem; }

.tentang-section { margin-bottom: 2rem; }
.tentang-section h2 {
    font-size: 1.2rem;
    margin-bottom: 0.75rem;
    font-weight: 600;
}
.tentang-section p {
    line-height: 1.7;
    color: #333;
    margin-bottom: 0.75rem;
}
.tentang-list {
    padding-left: 1.5rem;
    line-height: 1.9;
    color: #333;
}
.tentang-list li { margin-bottom: 0.35rem; }
.tentang-list a { color: #2d5a3f; text-decoration: underline; }

.tentang-credits {
    background: rgba(45, 90, 63, 0.04);
    border-left: 3px solid #2d5a3f;
    padding: 1.25rem 1.5rem;
    border-radius: 0 8px 8px 0;
}
.tentang-version {
    margin-top: 1rem;
    font-size: 0.85rem;
    color: #999;
    font-style: italic;
}

@media (max-width: 640px) {
    .tentang-page { padding: 1.25rem 1rem; }
    .tentang-logo { width: 70px; }
    .tentang-hero h1 { font-size: 1.4rem; }
    .tentang-section h2 { font-size: 1.05rem; }
}

/* Polish native select di form */
#form-mulai select {
    width: 100%;
    padding: 0.65rem 0.9rem;
    border: 1px solid var(--border, #ddd);
    border-radius: 6px;
    background-color: #fff;
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--text-utama, #1a1a1a);
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23666'%3e%3cpath d='M4 6l4 4 4-4'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px;
    padding-right: 2.25rem;
}
#form-mulai select:focus {
    outline: none;
    border-color: var(--tombol-aktif, #2d5a3f);
    box-shadow: 0 0 0 3px rgba(45, 90, 63, 0.15);
}

/* ========== Hafalan List (Riwayat hafalan user di beranda) ========== */
.hafalan-list-section {
    margin-top: 1rem;
}

.hafalan-list-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}

.hafalan-list-head h3 {
    margin: 0;
    font-size: 1.05rem;
}

.hafalan-toggle-visibility {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-terjemah);
    padding: 0.3rem 0.7rem;
    border-radius: 999px;
    font-size: 0.8rem;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s ease;
}

.hafalan-toggle-visibility:hover {
    border-color: var(--text-utama);
    color: var(--text-utama);
}

.hafalan-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
}

.hafalan-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.hafalan-table thead th {
    background: rgba(0,0,0,0.04);
    text-align: left;
    padding: 0.65rem 0.85rem;
    font-weight: 600;
    color: var(--text-utama);
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--border);
}

.hafalan-table tbody tr {
    border-bottom: 1px solid #f3f3f3;
    transition: background 0.15s ease;
    cursor: pointer;
}

.hafalan-table tbody tr:last-child {
    border-bottom: none;
}

.hafalan-table tbody tr:hover {
    background: rgba(0,0,0,0.025);
}

.hafalan-table td {
    padding: 0.7rem 0.85rem;
    color: var(--text-utama);
    vertical-align: middle;
}

.hafalan-table td.col-status {
    font-weight: 600;
    white-space: nowrap;
}

.hafalan-status-bar {
    position: relative;
    display: inline-block;
    min-width: 70px;
}

.hafalan-status-text {
    position: relative;
    z-index: 1;
    font-size: 0.85rem;
}

.hafalan-empty {
    padding: 1.5rem;
    text-align: center;
    color: var(--text-sekunder);
    font-size: 0.9rem;
}

@media (max-width: 480px) {
    .hafalan-table thead th,
    .hafalan-table td {
        padding: 0.55rem 0.5rem;
        font-size: 0.82rem;
    }
    .hafalan-table thead th {
        font-size: 0.7rem;
    }
}

/* ============================================
   ✨ Tabel Lengkap Surah (Mulai Hafalan) — Responsive
   ============================================ */
.surah-table-card {
    padding: 0.85rem 1rem;   /* samakan dgn .home-link-bar agar jarak terlihat seragam */
}

.surah-table-head {
    margin-bottom: 0.85rem;
}

.surah-table-head h3 {
    margin: 0 0 0.25rem;
    font-size: 1.1rem;
}

.surah-table-sub {
    margin: 0;
    font-size: 0.82rem;
    color: var(--text-sekunder);
    line-height: 1.4;
}

.surah-table-wrap {
    /* Tinggi ~10 baris × 38px + header + footer ≈ 460px */
    max-height: 460px;
    overflow-y: auto;
    overflow-x: hidden;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    scrollbar-width: thin;
    /* Footer total sticky di bawah wrap-nya */
    position: relative;
}

.surah-table-wrap::-webkit-scrollbar { width: 8px; }
.surah-table-wrap::-webkit-scrollbar-track { background: #f7f7f7; border-radius: 4px; }
.surah-table-wrap::-webkit-scrollbar-thumb { background: #ccc; border-radius: 4px; }
.surah-table-wrap::-webkit-scrollbar-thumb:hover { background: #999; }

.surah-table {
    width: 100%;
    border-collapse: collapse;
    /* Pakai clamp() supaya font otomatis menyesuaikan lebar layar */
    font-size: clamp(0.72rem, 2.6vw, 0.86rem);
    table-layout: fixed;
}

.surah-table thead {
    position: sticky;
    top: 0;
    background: #f7f7f7;
    z-index: 2;
}

.surah-table thead th {
    text-align: left;
    padding: 0.55rem 0.5rem;
    font-weight: 600;
    color: var(--text-utama);
    /* Header juga clamp supaya tidak overflow di layar kecil */
    font-size: clamp(0.6rem, 2.2vw, 0.72rem);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--border);
    background: #f7f7f7;
    white-space: nowrap;
}

/* Lebar kolom: total = 100%, fleksibel namun mengutamakan kolom Surat */
.surah-table .col-no     { width: 9%;  min-width: 28px; text-align: center; }
.surah-table .col-surah  { width: 38%; }
.surah-table .col-ayat   { width: 14%; text-align: center; }
.surah-table .col-hafal  { width: 14%; text-align: center; }
.surah-table .col-status { width: 25%; text-align: center; }

.surah-table tbody tr {
    border-bottom: 1px solid #f3f3f3;
    transition: background 0.12s ease;
    cursor: pointer;
}

.surah-table tbody tr:last-child {
    border-bottom: none;
}

.surah-table tbody tr:hover {
    background: rgba(0,0,0,0.03);
}

.surah-table tbody tr.is-started {
    background: rgba(45, 138, 79, 0.04);
}

.surah-table tbody tr.is-started:hover {
    background: rgba(45, 138, 79, 0.08);
}

.surah-table td {
    padding: 0.5rem;
    color: var(--text-utama);
    vertical-align: middle;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.surah-table td.col-no {
    color: var(--text-sekunder);
    text-align: center;
}

.surah-table td.col-surah {
    font-weight: 500;
}

.surah-table td.col-ayat,
.surah-table td.col-hafal,
.surah-table td.col-status {
    text-align: center;
    color: var(--text-terjemah);
    font-variant-numeric: tabular-nums;
}

.surah-table td.col-status {
    font-weight: 600;
    color: var(--text-utama);
}

/* ✨ Status persentase: inner span dengan rata kanan & tabular-nums.
   Span di-center dalam cell, tapi karena semua string sama panjang
   (di-pad oleh JS jadi "  0,00%" / " 42,86%" / "100,00%"),
   karakter "%" otomatis sejajar antar baris. */
.status-pct,
.num-cell {
    display: inline-block;
    text-align: right;
    font-variant-numeric: tabular-nums;
    /* font monospace untuk angka supaya lebar digit benar-benar sama */
    font-feature-settings: "tnum" 1;
    /* Pakai whitespace pre supaya leading-space tidak di-trim browser */
    white-space: pre;
}

.surah-table tbody tr.is-started td.col-status {
    color: var(--primary-color, #2d8a4f);
}

.surah-table tbody tr.is-complete {
    background: rgba(45, 138, 79, 0.1);
}

.surah-table tbody tr.is-complete td.col-status {
    color: var(--primary-color, #1d5a32);
}

.surah-table-empty {
    text-align: center !important;
    color: var(--text-sekunder);
    padding: 1.5rem !important;
    font-size: 0.88rem;
    cursor: default !important;
}

/* ===== Footer TOTAL (sticky di bawah wrap) ===== */
.surah-table tfoot {
    position: sticky;
    bottom: 0;
    background: #fafafa;
    z-index: 2;
}

.surah-table tfoot td {
    padding: 0.6rem 0.5rem;
    font-weight: 700;
    color: var(--primary-color, #1d5a32);
    border-top: 2px solid var(--border);
    font-size: clamp(0.72rem, 2.6vw, 0.86rem);
    font-variant-numeric: tabular-nums;
    cursor: default;
    background: #fafafa;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.surah-table tfoot td.col-surah {
    text-align: left;
    color: var(--primary-color, #1d5a32);
    letter-spacing: 0.02em;
}

.surah-table tfoot td.col-status {
    color: var(--primary-color, #1d5a32);
}

/* Mobile (≤480px) — perkecil lagi */
@media (max-width: 480px) {
    .surah-table-card {
        padding: 1rem 0.75rem;
    }
    .surah-table thead th,
    .surah-table td,
    .surah-table tfoot td {
        padding: 0.45rem 0.3rem;
    }

    /* ✨ FIX: kolom tetap berurutan & proporsional di mobile.
       Pakai table-layout: fixed + lebar persen tetap (bukan auto yang
       membuat lebar kolom acak/tidak berurutan). Kolom angka cukup ruang,
       hanya kolom Surah/Nama yang menyusut + ellipsis bila kepanjangan. */
    .surah-table { table-layout: fixed; width: 100%; }
    .surah-table .col-no     { width: 10%; min-width: 24px; text-align: center; }
    .surah-table .col-surah  { width: 38%; text-align: left; }
    .surah-table .col-ayat   { width: 15%; text-align: center; }
    .surah-table .col-hafal  { width: 15%; text-align: center; }
    .surah-table .col-status { width: 22%; text-align: center; }

    /* Angka tidak dipotong titik-titik */
    .surah-table td.col-ayat,
    .surah-table td.col-hafal,
    .surah-table td.col-status,
    .surah-table tfoot td.col-ayat,
    .surah-table tfoot td.col-hafal,
    .surah-table tfoot td.col-status {
        overflow: visible;
        text-overflow: clip;
        white-space: nowrap;
    }
    /* Hanya kolom Surah/Nama yang boleh dipotong (…) bila kepanjangan */
    .surah-table td.col-surah { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    /* Sedikit perkecil angka agar muat di HP sangat kecil */
    .surah-table td.col-ayat,
    .surah-table td.col-hafal,
    .surah-table tfoot td { font-size: 0.82rem; }
}

@media (max-width: 360px) {
    .surah-table thead th,
    .surah-table td,
    .surah-table tfoot td {
        padding: 0.4rem 0.22rem;
    }
}

/* ============================================
   ✨ Search Ayat Compact
   ============================================ */
.search-ayat-card {
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.5rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.search-ayat-form {
    display: flex;
    gap: 0.4rem;
    align-items: stretch;
}

.search-ayat-form input[type="search"] {
    flex: 1;
    padding: 0.55rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.9rem;
    background: #fff;
}

.search-ayat-form input[type="search"]:focus {
    outline: none;
    border-color: var(--tombol-aktif);
}

.search-ayat-btn {
    padding: 0.55rem 1rem;
    font-size: 0.88rem;
    border-radius: 6px;
    white-space: nowrap;
}

#search-ayat-results:not(:empty) {
    margin-top: 0.7rem;
    padding: 0 0.3rem;
}

/* Saat kosong, hilangkan dari layout supaya tidak konsumsi flex gap parent */
#search-ayat-results:empty {
    display: none;
}

@media (max-width: 480px) {
    .search-ayat-form input[type="search"] {
        font-size: 0.85rem;
        padding: 0.5rem 0.7rem;
    }
    .search-ayat-btn {
        padding: 0.5rem 0.8rem;
        font-size: 0.82rem;
    }
}

/* ============================================
   ✨ Home Links — 2 bar (gantikan interest bars)
   ============================================ */
.home-links-section {
    margin-bottom: 0;        /* di-handle oleh .home-stack gap */
    display: flex;
    flex-direction: column;
    gap: 1rem;               /* ✨ sama dengan .home-stack gap supaya konsisten */
}

.home-link-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.85rem;
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.85rem 1rem;
    margin-bottom: 0;        /* gap di parent yang handle jarak */
    transition: all 0.2s ease;
}

.home-link-bar:hover {
    border-color: var(--text-terjemah);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.home-link-label {
    flex: 1;
    min-width: 0;
    color: var(--text-utama);
    font-size: 0.95rem;
    font-weight: 500;
    line-height: 1.35;
}

.home-link-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    border: 1.5px solid transparent;   /* ✨ transparent default — border muncul saat hover */
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-utama);
    background: transparent;
    text-decoration: none;
    transition: all 0.2s ease;
    flex-shrink: 0;
    white-space: nowrap;
    font-family: inherit;
    cursor: pointer;
    line-height: 1.2;
}

.home-link-cta:hover {
    border-color: var(--text-utama);
    background: var(--text-utama);
    color: #fff;
}

/* ✨ Tombol panah sederhana (ganti tombol teks "Lihat/Putar" di beranda).
   Mirip ikon collapse di Data Penghafal, tapi menghadap ke kanan. */
.home-link-cta.is-arrow {
    padding: 0.35rem !important;
    width: 38px;
    min-width: 38px;
    height: 38px;
    border-radius: 50%;
    color: var(--text-utama);
    flex: 0 0 auto;
}
.home-link-cta.is-arrow svg {
    display: block;
    width: 20px !important;
    height: 20px !important;
    flex: 0 0 auto;
    stroke: currentColor;
}
.home-link-cta.is-arrow:hover {
    background: var(--text-utama);
    color: #fff;
    border-color: var(--text-utama);
}
.home-link-cta.is-arrow:hover svg { stroke: #fff; }

/* Bar dengan search box (Bar 1) */
.home-link-bar-search {
    flex-direction: column;
    align-items: stretch;
    gap: 0.55rem;
}

.home-link-bar-search .home-link-label {
    text-align: left;
}

.home-link-search-form {
    display: flex;
    gap: 0.4rem;
    align-items: stretch;
}

.home-link-search-form input[type="search"] {
    flex: 1;
    padding: 0.55rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: 8px;            /* ✨ rectangle rounded (sebelumnya 999px) */
    font-size: 0.85rem;
    background: #fff;
    font-family: inherit;
}

.home-link-search-form input[type="search"]:focus {
    outline: none;
    border-color: var(--tombol-aktif);
}

.home-link-search-form .home-link-cta {
    padding: 0.5rem 1.1rem;
}

@media (max-width: 480px) {
    .home-link-bar {
        padding: 0.75rem 0.85rem;
    }
    .home-link-label {
        font-size: 0.88rem;
    }
    .home-link-cta {
        font-size: 0.78rem;
        padding: 0.4rem 0.85rem;
    }
}

/* ============================================
   ✨ Gap untuk card Lanjut Hafalan dan Cari Ayat
   (saat keduanya tampil bersama setelah login)
   ============================================ */
#lanjut-hafalan-container + .search-ayat-card {
    margin-top: 1.25rem;
}

/* ============================================
   ✨ Hamburger Button & Mobile Menu
   ============================================ */
.nav-hamburger {
    display: none;       /* hidden by default, hanya muncul di mobile */
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: 38px;
    height: 38px;
    padding: 6px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.18s ease, border-color 0.18s ease;
}

.nav-hamburger:hover {
    background: rgba(0,0,0,0.04);
    border-color: var(--text-utama);
}

.nav-hamburger span {
    display: block;
    width: 18px;
    height: 2px;
    background: var(--text-utama);
    border-radius: 2px;
    transform-origin: center;
    transition: transform 0.25s ease, opacity 0.25s ease;
}

/* State: hamburger open (X icon) */
.nav-hamburger.is-open span:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
}
.nav-hamburger.is-open span:nth-child(2) {
    opacity: 0;
}
.nav-hamburger.is-open span:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
}

/* ===== Mobile Menu Panel ===== */
.nav-mobile-menu {
    position: fixed;
    inset: 0;
    z-index: 200; /* di atas navbar (z-index 100) */
    pointer-events: none;
    visibility: hidden;
}

.nav-mobile-menu.is-open {
    pointer-events: auto;
    visibility: visible;
}

.nav-mobile-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.45);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.nav-mobile-menu.is-open .nav-mobile-backdrop {
    opacity: 1;
}

/* ===== Mobile Menu Panel ===== */
.nav-mobile-panel {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 82%;
    max-width: 300px;
    background: #fff;
    box-shadow: -4px 0 24px rgba(0,0,0,0.18);
    transform: translateX(100%);
    transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1);
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 1.25rem 1rem 1.5rem;
    box-sizing: border-box;
    -webkit-overflow-scrolling: touch;
}

/* Header panel: tombol close ✕ di atas */
.nav-mobile-panel::before {
    content: '';
    display: block;
    height: 0.5rem;
}

.nav-mobile-close {
    position: absolute;
    top: 0.5rem;
    right: 0.6rem;
    width: 34px;
    height: 34px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 1.55rem;
    line-height: 1;
    color: var(--text-utama);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    z-index: 1;
    transition: background 0.15s ease;
    font-family: inherit;
}

.nav-mobile-close:hover {
    background: rgba(0,0,0,0.04);
}

/* Beri margin atas ke isi panel supaya tidak ditutupi tombol close */
.nav-mobile-panel .nav-mobile-user {
    margin-top: 2.5rem;
}

.nav-mobile-menu.is-open .nav-mobile-panel {
    transform: translateX(0);
}

/* ===== User section (login state) ===== */
.nav-mobile-user {
    margin: 0 0 1rem;
    padding: 0 0 1rem;
    border-bottom: 1px solid var(--border);
    width: 100%;
    box-sizing: border-box;
}

/* Tombol Masuk + Daftar (saat belum login) */
.nav-mobile-user .nav-mobile-auth-buttons {
    display: flex;
    gap: 0.5rem;
    width: 100%;
}

.nav-mobile-user .nav-mobile-auth-btn {
    flex: 1 1 0;
    min-width: 0;
    padding: 0.6rem 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: 999px;
    border: 1.5px solid var(--text-utama);
    background: transparent;
    color: var(--text-utama);
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    font-family: inherit;
    line-height: 1;
    transition: all 0.18s ease;
    white-space: nowrap;
}

.nav-mobile-user .nav-mobile-auth-btn.primary {
    background: var(--text-utama);
    color: #fff;
}

/* Badge user yang sudah login */
.nav-mobile-user-logged {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.65rem 0.7rem;
    background: rgba(0,0,0,0.035);
    border-radius: 10px;
    width: 100%;
    box-sizing: border-box;
}

.nav-mobile-user-icon {
    width: 34px;
    height: 34px;
    background: var(--text-utama);
    color: #fff;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    flex-shrink: 0;
}

.nav-mobile-user-info {
    flex: 1 1 0;
    min-width: 0; /* penting supaya text-overflow ellipsis bekerja */
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    overflow: hidden;
}

.nav-mobile-user-name {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-utama);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
    line-height: 1.25;
}

.nav-mobile-user-name.is-expanded {
    overflow: visible;
    word-break: break-all;
    white-space: normal;
}

.nav-mobile-user-realname {
    font-size: 0.72rem;
    color: var(--text-sekunder);
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nav-mobile-logout {
    background: transparent;
    border: 1px solid rgba(204, 51, 51, 0.35);
    color: #cc3333;
    padding: 0.32rem 0.6rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    flex-shrink: 0;
    line-height: 1;
    transition: all 0.18s ease;
}

.nav-mobile-logout:hover {
    background: #cc3333;
    color: #fff;
}

/* ===== Navigation links ===== */
.nav-mobile-links {
    list-style: none;
    margin: 0;
    padding: 0;
    width: 100%;
    box-sizing: border-box;
}

.nav-mobile-links li {
    width: 100%;
}

.nav-mobile-links li + li {
    margin-top: 0.2rem;
}

.nav-mobile-links a {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.7rem 0.75rem;
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-utama);
    font-size: 0.92rem;
    font-weight: 500;
    transition: background 0.15s ease;
    width: 100%;
    box-sizing: border-box;
}

.nav-mobile-links a:hover,
.nav-mobile-links a.active {
    background: rgba(0,0,0,0.05);
}

.nav-mobile-links a.active {
    font-weight: 700;
}

.nav-mobile-icon {
    font-size: 1rem;
    width: 22px;
    text-align: center;
    flex-shrink: 0;
}

/* Username truncate (desktop) */
.nav-user-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 80px;
    cursor: pointer;
    user-select: none;
}

.nav-user-name.is-expanded {
    overflow: visible;
    max-width: none;
}

/* Hide hamburger di desktop */
@media (min-width: 641px) {
    .nav-hamburger { display: none !important; }
    .nav-mobile-menu { display: none !important; }
}

/* ============================================
   ✨ Setting Modal
   ============================================ */
.setting-modal {
    position: fixed;
    inset: 0;
    z-index: 9997;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.setting-modal.is-open {
    display: flex;
}

.setting-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.setting-modal-content {
    position: relative;
    background: #fff;
    border-radius: 14px;
    max-width: 480px;
    width: 100%;
    max-height: 88vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
    padding: 1.5rem 1.5rem 1.25rem;
}

.setting-modal-close {
    position: absolute;
    top: 0.5rem;
    right: 0.6rem;
    width: 34px;
    height: 34px;
    border: none;
    background: transparent;
    font-size: 1.6rem;
    line-height: 1;
    color: var(--text-sekunder);
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.15s ease;
}

.setting-modal-close:hover {
    background: rgba(0,0,0,0.05);
    color: var(--text-utama);
}

.setting-modal h3 {
    margin: 0 0 0.25rem;
    font-size: 1.2rem;
}

.setting-modal-sub {
    color: var(--text-sekunder);
    font-size: 0.85rem;
    margin-bottom: 1.25rem;
}

.setting-section {
    margin-bottom: 1.25rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--border);
}

.setting-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.setting-section-title {
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-sekunder);
    margin-bottom: 0.65rem;
}

.setting-field {
    margin-bottom: 0.75rem;
}

.setting-field label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-utama);
    margin-bottom: 0.35rem;
}

.setting-field input,
.setting-field select {
    width: 100%;
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.92rem;
    font-family: inherit;
    background: #fff;
}

.setting-field input:focus,
.setting-field select:focus {
    outline: none;
    border-color: var(--text-utama);
    box-shadow: 0 0 0 3px rgba(0,0,0,0.06);
}

/* ===== Toggle Switch (hijau on / merah off, tanpa icon) ===== */
.setting-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.85rem;
    padding: 0.55rem 0;
}

.setting-toggle-label {
    flex: 1;
    font-size: 0.9rem;
    color: var(--text-utama);
    line-height: 1.35;
}

.setting-toggle {
    flex-shrink: 0;
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
}

.setting-toggle input[type="checkbox"] {
    position: absolute;
    width: 1px; height: 1px;
    opacity: 0;
    pointer-events: none;
}

.setting-toggle-track {
    position: absolute;
    inset: 0;
    background: #d04444;   /* default: OFF = merah */
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.22s ease;
}

.setting-toggle-thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.22s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.25);
}

.setting-toggle input:checked + .setting-toggle-track {
    background: #2d8a4f;   /* ON = hijau */
}

.setting-toggle input:checked + .setting-toggle-track .setting-toggle-thumb {
    transform: translateX(22px);
}

.setting-save-msg {
    margin-top: 0.4rem;
    font-size: 0.78rem;
    min-height: 1em;
}
.setting-save-msg.ok { color: #2d8a4f; }
.setting-save-msg.err { color: #cc3333; }

@media (max-width: 480px) {
    .setting-modal-content {
        padding: 1.25rem 1.1rem 1rem;
    }
}

/* ============================================
   ✨ Custom Select Dropdown (replace native <select>)
   Tujuan: di mobile tidak full-screen, jaga UX konsisten desktop & mobile
   ============================================ */
.custom-select {
    position: relative;
    width: 100%;
    /* Penting: layering supaya saat dibuka, dropdown overlay di atas elemen lain */
    z-index: 1;
}

.custom-select.is-open {
    z-index: 50; /* angkat saat terbuka supaya tidak ditutupi sibling */
}

.custom-select-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    width: 100%;
    padding: 0.55rem 0.7rem 0.55rem 0.9rem;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.92rem;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    color: var(--text-utama);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    line-height: 1.3;
    min-height: 40px;
}

.custom-select-btn:hover {
    border-color: var(--text-terjemah);
}

.custom-select-btn:focus,
.custom-select.is-open .custom-select-btn {
    outline: none;
    border-color: var(--text-utama);
    box-shadow: 0 0 0 3px rgba(0,0,0,0.06);
}

.custom-select-text {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.custom-select-arrow {
    color: var(--text-sekunder);
    font-size: 0.85rem;
    transition: transform 0.18s ease;
    flex-shrink: 0;
}

.custom-select.is-open .custom-select-arrow {
    transform: rotate(180deg);
}

/* Dropdown list — PAKAI position: fixed supaya tidak ke-clip oleh parent overflow */
.custom-select-list {
    position: fixed;
    /* top/left/width di-set oleh JS saat dibuka */
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.18);
    list-style: none;
    margin: 0;
    padding: 0.25rem;
    max-height: 260px;
    overflow-y: auto;
    overflow-x: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
    z-index: 10000;     /* di atas modal apa pun (auth-modal 9999) */
    -webkit-overflow-scrolling: touch;
    box-sizing: border-box;
}

.custom-select.is-open .custom-select-list {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.custom-select.drop-up.is-open .custom-select-list {
    transform: translateY(0);
}

.custom-select-list li {
    padding: 0.55rem 0.7rem;
    border-radius: 4px;
    font-size: 0.9rem;
    color: var(--text-utama);
    cursor: pointer;
    line-height: 1.35;
    transition: background 0.12s ease;
    user-select: none;
}

.custom-select-list li:hover,
.custom-select-list li[data-highlighted="true"] {
    background: rgba(0,0,0,0.05);
}

.custom-select-list li[data-selected="true"] {
    background: rgba(45, 138, 79, 0.1);
    color: #1d5a32;
    font-weight: 600;
}

.custom-select-list li[data-selected="true"]::after {
    content: '✓';
    float: right;
    color: #2d8a4f;
    margin-left: 0.5rem;
}

/* Scrollbar dropdown */
.custom-select-list::-webkit-scrollbar { width: 6px; }
.custom-select-list::-webkit-scrollbar-track { background: #f7f7f7; }
.custom-select-list::-webkit-scrollbar-thumb { background: #ccc; border-radius: 3px; }

@media (max-width: 480px) {
    .custom-select-btn {
        font-size: 0.88rem;
        padding: 0.55rem 0.65rem 0.55rem 0.8rem;
    }
    .custom-select-list li {
        padding: 0.65rem 0.7rem;
        font-size: 0.88rem;
    }
    .custom-select-list {
        max-height: 220px;
    }
}

/* ============================================
   ✨ Waktu Sholat
   ============================================ */
.prayer-times-section {
    margin-bottom: 1.5rem;   /* ✨ jarak konsisten antar section beranda */
}

.prayer-times-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.55rem;
    padding: 0 0.2rem;
}

.prayer-times-label {
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-sekunder);
}

.prayer-times-tz {
    font-size: 0.72rem;
    color: var(--text-sekunder);
    background: rgba(0,0,0,0.05);
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    font-weight: 600;
}

.prayer-times-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.45rem;
}

.prayer-time-card {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.75rem 0.4rem;
    text-align: center;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.prayer-time-card.is-active {
    /* ✨ Hijau menyala = waktu sholat berikutnya yang akan datang */
    background: #d6f5e0;
    border-color: #2d8a4f;
    box-shadow: 0 0 0 3px rgba(45, 138, 79, 0.18);
}

.prayer-time-name {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-utama);
    margin-bottom: 0.2rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.prayer-time-card.is-active .prayer-time-name { color: var(--primary-color, #1d5a32); }

.prayer-time-clock {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--text-utama);
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.01em;
}

.prayer-time-card.is-active .prayer-time-clock { color: var(--primary-color, #1d5a32); }

@media (max-width: 480px) {
    .prayer-times-grid {
        gap: 0.35rem;
    }
    .prayer-time-card {
        padding: 0.6rem 0.25rem;
        border-radius: 8px;
    }
    .prayer-time-name {
        font-size: 0.65rem;
    }
    .prayer-time-clock {
        font-size: 0.82rem;
    }
}

@media (max-width: 360px) {
    .prayer-time-name {
        font-size: 0.6rem;
    }
    .prayer-time-clock {
        font-size: 0.76rem;
    }
}

/* ============================================
   ✨ PWA Install Banner
   ============================================ */
.pwa-install-banner {
    position: fixed;
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
    z-index: 9990;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.18), 0 2px 6px rgba(0,0,0,0.08);
    padding: 0.85rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.85rem;
    max-width: 480px;
    margin: 0 auto;
    transform: translateY(120%);
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
}

.pwa-install-banner.is-visible {
    transform: translateY(0);
    opacity: 1;
}

.pwa-install-icon {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border-radius: 10px;
    overflow: hidden;
    background: rgba(0,0,0,0.04);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.pwa-install-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.pwa-install-text {
    flex: 1;
    min-width: 0;
    line-height: 1.3;
}

.pwa-install-title {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text-utama);
    margin-bottom: 0.15rem;
}

.pwa-install-desc {
    font-size: 0.78rem;
    color: var(--text-sekunder);
    line-height: 1.4;
}

.pwa-install-btn {
    flex-shrink: 0;
    padding: 0.55rem 1rem;
    border: none;
    border-radius: 8px;
    background: var(--text-utama);
    color: #fff;
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.18s ease, transform 0.1s ease;
    white-space: nowrap;
}

.pwa-install-btn:hover { background: var(--tombol-hover); }
.pwa-install-btn:active { transform: scale(0.97); }

.pwa-install-close {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    background: transparent;
    border: none;
    border-radius: 6px;
    font-size: 1.4rem;
    line-height: 1;
    color: var(--text-sekunder);
    cursor: pointer;
    font-family: inherit;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease;
}

.pwa-install-close:hover {
    background: rgba(0,0,0,0.05);
    color: var(--text-utama);
}

@media (max-width: 480px) {
    .pwa-install-banner {
        left: 0.5rem;
        right: 0.5rem;
        bottom: 0.5rem;
        padding: 0.7rem 0.85rem;
        gap: 0.65rem;
    }
    .pwa-install-icon {
        width: 38px;
        height: 38px;
    }
    .pwa-install-title { font-size: 0.86rem; }
    .pwa-install-desc { font-size: 0.74rem; }
    .pwa-install-btn {
        padding: 0.5rem 0.85rem;
        font-size: 0.8rem;
    }
}

/* ============================================
   ✨ Setting modal — Section Aplikasi
   ============================================ */
.setting-app-row {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.5rem 0;
}

.setting-app-info {
    flex: 1;
    min-width: 0;
}

.setting-app-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-utama);
    margin-bottom: 0.15rem;
}

.setting-app-desc {
    font-size: 0.78rem;
    color: var(--text-sekunder);
    line-height: 1.4;
}

.setting-app-btn {
    flex-shrink: 0;
    white-space: nowrap;
}

.setting-app-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ============================================
   admin-btn helper (untuk install button di Setting)
   ============================================ */
button.admin-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.55rem 1rem;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-utama);
    cursor: pointer;
    font-family: inherit;
    line-height: 1.2;
    transition: all 0.18s ease;
    white-space: nowrap;
}

button.admin-btn.primary {
    background: var(--text-utama);
    border-color: var(--text-utama);
    color: #fff;
}

button.admin-btn:hover { border-color: var(--text-utama); }
button.admin-btn.primary:hover { background: var(--tombol-hover); border-color: var(--tombol-hover); }

/* ============================================
   ✨ Tombol Go to Top — hanya aktif saat search Cari Tema dipakai
   ============================================ */
.go-to-top-btn {
    position: fixed;
    right: 1.25rem;
    bottom: 1.25rem;
    width: 46px;
    height: 46px;
    background: var(--text-utama);
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 18px rgba(0,0,0,0.22), 0 2px 4px rgba(0,0,0,0.1);
    z-index: 95;
    opacity: 0;
    transform: translateY(12px) scale(0.9);
    transition: opacity 0.22s ease, transform 0.22s ease, background 0.18s ease;
    font-family: inherit;
    padding: 0;
}

.go-to-top-btn[hidden] {
    display: none !important;
}

.go-to-top-btn.is-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.go-to-top-btn:hover {
    background: var(--tombol-hover);
    transform: translateY(-2px) scale(1.04);
}

.go-to-top-btn:active {
    transform: scale(0.94);
}

@media (max-width: 480px) {
    .go-to-top-btn {
        right: 1rem;
        bottom: 1rem;
        width: 42px;
        height: 42px;
    }
}

/* ============================================
   ✨ Beranda — Stack section dengan gap konsisten
   Semua direct child (sas-brand, prayer-times, home-link-bar,
   surah-table-card) jadi sibling level dengan gap yang sama.
   ============================================ */
.home-stack {
    display: flex;
    flex-direction: column;
    gap: 1rem;               /* ✨ jarak konsisten antar SEMUA box di beranda */
}

/* Reset margin (atas & bawah) semua direct child .home-stack
   supaya yang bekerja HANYA gap parent (deterministic).
   Selector lebih specific dari aturan section masing-masing
   (termasuk .card yang punya margin-bottom 1rem). */
.home-stack > * {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}

/* Sas brand sedikit special — diberi margin extra di bawah karena ada
   tagline & bismillah, supaya tidak terlalu nempel ke prayer-times.
   Tapi tetap pakai padding bawah, bukan margin. */
.home-stack > .sas-brand {
    padding-bottom: 0.5rem;
}

@media (max-width: 480px) {
    .home-stack {
        gap: 0.85rem;
    }
}

/* ===== #16 Popup Logo ===== */
.logo-img[role="button"] { cursor: pointer; }
.logo-popup-overlay {
    position: fixed; inset: 0; z-index: 9999;
    background: rgba(0,0,0,0.6); backdrop-filter: blur(2px);
    display: flex; align-items: center; justify-content: center; padding: 1.5rem;
}
.logo-popup-overlay[hidden] { display: none !important; }
.logo-popup-box { position: relative; background: #fff; border-radius: 16px; padding: 1.5rem; max-width: 90vw; max-height: 90vh; box-shadow: 0 12px 40px rgba(0,0,0,0.3); }
.logo-popup-img { display: block; max-width: 70vw; max-height: 70vh; width: auto; height: auto; border-radius: 10px; }
.logo-popup-close { position: absolute; top: -12px; right: -12px; width: 36px; height: 36px; border-radius: 50%; border: none; background: #fff; color: #333; font-size: 1.4rem; line-height: 1; cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,0.25); }
.logo-popup-close:hover { background: #f0f0f0; }

/* ===== #11 Urutan beranda: Jam → Jadwal Sholat → Daftar Hafalan → Data Penghafal → sisanya ===== */
/* ✨ Sapaan "Assalamualaikum" HARUS paling atas → order paling kecil.
   (Inilah penyebab sebelumnya: greeting tanpa order = 0, jadi tampil setelah
    elemen ber-order negatif meski sudah dipindah di DOM.) */
.home-stack > .home-greeting-bar { order: -5; }
.home-stack > .bar-date { order: -4; }
.home-stack > .prayer-times-section { order: -3; }
.home-stack > .surah-table-card:not(.home-data-penghafal) { order: -2; }
.home-stack > .home-data-penghafal { order: -1; }

/* ===== #15 Total ayat & hafal rata kanan, sejajar angka kolomnya ===== */
.surah-table .col-ayat,
.surah-table .col-hafal,
.surah-table td.col-ayat,
.surah-table td.col-hafal,
.surah-table tfoot td.col-ayat,
.surah-table tfoot td.col-hafal { text-align: right; padding-right: 0.6rem; }

/* ==========================================================
   ✨ IKON SOSIAL MEDIA (footer desktop + sidebar mobile)
   ========================================================== */
.social-icons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
    align-items: center;
}
.social-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    /* ✨ Default: pakai warna ASLI tiap platform (var --brand dari social.php),
       ikon putih. Instagram & Snapchat dapat perlakuan khusus di bawah. */
    color: #fff;
    background: var(--brand, #1a1a1a);
    border: none;
    transition: transform .15s ease, background .15s ease, color .15s ease, box-shadow .15s ease;
    text-decoration: none;
}
.social-icon svg { width: 20px; height: 20px; display: block; }

/* Instagram: gradient resmi sebagai DEFAULT */
.social-icon--instagram {
    background: radial-gradient(circle at 30% 107%,
        #fdf497 0%, #fdf497 5%, #fd5949 45%, #d6249f 60%, #285AEB 90%);
}
/* Snapchat: latar kuning terang → ikon gelap (default) */
.social-icon--snapchat { color: #1a1a1a; }

/* ✨ HOVER = REVERSE: latar putih, ikon memakai warna brand (kontras, tidak
   tumpang-tindih). Cincin tipis warna brand supaya tetap terbaca sebagai platform. */
.social-icon:hover,
.social-icon:focus-visible {
    transform: translateY(-2px);
    background: #fff;
    color: var(--brand, #1a1a1a);
    box-shadow: inset 0 0 0 2px var(--brand, #1a1a1a), 0 5px 14px rgba(0,0,0,0.16);
    outline: none;
}
/* Instagram reverse: ikon warna ungu-pink khas IG di atas putih + cincin IG */
.social-icon--instagram:hover,
.social-icon--instagram:focus-visible {
    background: #fff;
    color: #d6249f;
    box-shadow: inset 0 0 0 2px #d6249f, 0 5px 14px rgba(0,0,0,0.16);
}
/* Snapchat reverse: kuning hampir putih sulit dibaca → ikon gelap + cincin emas */
.social-icon--snapchat:hover,
.social-icon--snapchat:focus-visible {
    background: #fff;
    color: #1a1a1a;
    box-shadow: inset 0 0 0 2px #f1c40f, 0 5px 14px rgba(0,0,0,0.16);
}

/* Footer: ikon di tengah, di atas baris teks */
.footer-two-line .social-icons--footer {
    justify-content: center;
    margin: 0 0 0.85rem;
}

/* Sidebar mobile: blok di bawah toggle bahasa */
.nav-mobile-social {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid rgba(0,0,0,0.08);
}
.nav-mobile-social-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-sekunder, #888);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 0.55rem;
}
.nav-mobile-social .social-icons--sidebar { justify-content: flex-start; }

/* Footer dipercantik sedikit */
.footer-two-line { padding-top: 1.4rem; padding-bottom: 1.4rem; }
.footer-two-line .footer-line-1 { font-weight: 600; }
