/* Quran — Shared App Styles */
/* Structural layout and FluentUI overrides reused by all Quran Blazor apps. */
/* Host app must define the --b-* CSS custom properties (colours stay per-app).   */

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

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    background: var(--b-bg);
    color: var(--b-text);
    -webkit-font-smoothing: antialiased;
}

/* ─── FluentHeader ────────────────────────────────────────────────────────── */
/* FluentUI sets background-color via --accent-fill-rest on the .header class.
   Transparent lets the layout's own background show through.                  */
.siteheader {
    background-color: transparent !important;
    background: transparent !important;
    border-top: none !important;
    border-block-start: none !important;
    border-bottom: 1px solid var(--b-border) !important;
    margin-bottom: 0 !important;
}

.siteheader .settings {
    display: flex;
    align-items: center;
    padding-right: 6px;
    margin-right: 4px;
}

.siteheader .signinout {
    display: flex;
    align-items: center;
}

/* ─── FluentNavMenu ───────────────────────────────────────────────────────── */
fluent-nav-menu {
    background: var(--b-sidebar-bg) !important;
    border-right: 1px solid var(--b-border) !important;
}

/* ─── FluentFooter ────────────────────────────────────────────────────────── */
fluent-footer {
    background: var(--b-bg) !important;
    border-top: 1px solid var(--b-border) !important;
    margin: 0 !important;
    flex-shrink: 0 !important;
}

.version, .copy {
    font-size: var(--type-ramp-minus-1-font-size, 12px);
}

/* ─── Blazor error UI ─────────────────────────────────────────────────────── */
#blazor-error-ui {
    background: #1A0000;
    color: #FF4757;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0,0,0,0.4);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

/* ─── Table / select / form utilities ────────────────────────────────────── */
.f-table { width:100%; border-collapse:collapse; font-size:14px; }
.f-table th { padding:10px 16px; text-align:left; font-size:12px; font-weight:600; color:var(--b-text-2); background:var(--b-surface-2); border-bottom:1px solid var(--b-border); white-space:nowrap; }
.f-table td { padding:10px 16px; border-bottom:1px solid var(--b-border); vertical-align:middle; }
.f-table tr:last-child td { border-bottom:none; }
.f-table tr:hover td { background:rgba(255,255,255,0.02); }
.f-table-wrap { border:1px solid var(--b-border); border-radius:8px; overflow:hidden; }
.f-actions { display:flex; flex-direction:row; gap:4px; align-items:center; white-space:nowrap; }

.f-select { background:var(--b-surface-2); border:1px solid var(--b-border); color:var(--b-text); border-radius:4px; padding:6px 10px; width:100%; font-family:inherit; font-size:14px; cursor:pointer; height:36px; }
.f-select:focus { outline:none; border-color:var(--b-accent); }

.f-label { display:block; font-size:12px; font-weight:500; color:var(--b-text-2); margin-bottom:4px; }
.f-field { margin-bottom:12px; }
.ro-label { font-size:11px; font-weight:600; color:var(--b-text-2); text-transform:uppercase; letter-spacing:.04em; margin-bottom:2px; }
.ro-value { font-size:14px; color:var(--b-text); }

/* ─── Colour tokens (dark defaults) ──────────────────────────────────────── */
:root {
    --color-primary-50: hsl(150, 98%, 97%);
    --color-primary-100: hsl(147, 100%, 93%);
    --color-primary-200: hsl(148, 99%, 87%);
    --color-primary-300: hsl(148, 99%, 79%);
    --color-primary-400: hsl(148, 100%, 69%);
    --color-primary-500: hsl(148, 100%, 58%);
    --color-primary-600: hsl(148, 100%, 49%);
    --color-primary-700: hsl(148, 100%, 41%);
    --color-primary-800: hsl(148, 100%, 33%);
    --color-primary-900: hsl(148, 100%, 26%);
    --color-primary-950: hsl(148, 100%, 20%);
    --b-danger: #FF4757;
    --b-success: #4ADE80;
    --b-warning: #FBBF24;
    --b-header-h: 58px;
    --b-sidebar-w: 160px;
    --r: 12px;
    --r-sm: 8px;
    --r-pill: 50px;
}

html, body {
    font-family: 'Barlow', sans-serif;
}

    /* ── Dark theme ──────────────────────────────────────────────────────── */
    body[data-app-theme="dark"] {
        --b-sidebar-bg: #121714;
        --b-bg: #191F1B;
        --b-surface: #202721;
        --b-surface-2: #2A322B;
        --b-surface-3: #343C37;
        --b-accent: var(--color-primary-500);
        --b-accent-dim: rgba(41, 255, 141, 0.10);
        --b-accent-glow: rgba(41, 255, 141, 0.22);
        --b-text: #F5F5F5;
        --b-text-2: #A2A9A6;
        --b-text-3: #5D6561;
        --b-border: rgba(255, 255, 255, 0.08);
    }

    /* ── Light theme ─────────────────────────────────────────────────────── */
    body[data-app-theme="light"] {
        --b-sidebar-bg: #DEE3E0;
        --b-bg: #E3E8E5;
        --b-surface: #FFFFFF;
        --b-surface-2: #E9ECEA;
        --b-surface-3: #D1DBD6;
        --b-accent: var(--color-primary-700);
        --b-accent-dim: rgba(0, 209, 98, 0.14);
        --b-accent-glow: rgba(0, 209, 98, 0.26);
        --b-text: #151917;
        --b-text-2: #4D5651;
        --b-text-3: #7A857F;
        --b-border: rgba(0, 0, 0, 0.12);
    }

/* ── Layout ─────────────────────────────────────────────────────────────── */
.app-layout {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    background: var(--b-bg);
}

/* ── Header ─────────────────────────────────────────────────────────────── */
.app-header {
    background: var(--b-bg);
    border-bottom: 1px solid var(--b-border);
    padding: 0 20px 0 10px;
    height: var(--b-header-h);
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    z-index: 200;
}

.app-header-title {
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--b-text);
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

/* ── Body ────────────────────────────────────────────────────────────────── */
.app-body {
    flex: 1;
    overflow: hidden;
    position: relative;
}

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
.app-sidebar {
    width: var(--b-sidebar-w);
    background: var(--b-sidebar-bg);
    border-right: 1px solid var(--b-border);
    padding: 12px 0;
    flex-shrink: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    scrollbar-width: none;
}

    .app-sidebar::-webkit-scrollbar {
        display: none;
    }

.app-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 14px 8px 12px;
    text-decoration: none;
    color: var(--b-text-3);
    font-family: 'Barlow', sans-serif;
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    gap: 5px;
    text-align: center;
    cursor: pointer;
    transition: color 0.2s, background 0.2s, border-left-color 0.2s;
    border-left: 3px solid transparent;
    width: 100%;
}

    .app-nav-item:hover {
        background: var(--b-accent-dim);
        color: var(--b-text-2);
        text-decoration: none;
    }

    .app-nav-item.active {
        background: var(--b-accent-dim);
        border-left-color: var(--b-accent);
        color: var(--b-accent);
    }

body[data-app-theme="light"] .app-nav-item:hover {
    background: var(--b-accent-dim);
    color: var(--b-accent);
}

body[data-app-theme="light"] .app-nav-item.active {
    background: var(--b-accent-glow);
    color: var(--b-accent);
}

/* ── Main content ────────────────────────────────────────────────────────── */
.app-main {
    height: 100%;
    overflow-y: auto;
    padding: 28px;
    background: var(--b-bg);
    scrollbar-width: thin;
    scrollbar-color: var(--b-surface-3) transparent;
    box-sizing: border-box;
}

/* ── Greeting ─────────────────────────────────────────────────────────────── */
.app-greeting {
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 2rem;
    font-weight: 800;
    color: var(--b-text);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1;
    margin-bottom: 4px;
}

.app-greeting-sub {
    font-size: 0.82rem;
    color: var(--b-text-2);
    margin-bottom: 28px;
    font-weight: 400;
}

body[data-app-theme="light"] .app-greeting-sub {
    color: var(--b-text-2);
}

/* ── Section title ─────────────────────────────────────────────────────────── */
.app-section-title {
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    color: var(--b-text-3);
    margin: 0 0 16px 0;
}

body[data-app-theme="light"] .app-section-title {
    color: var(--b-text-2);
}

/* ── Stats grid ──────────────────────────────────────────────────────────── */
.app-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 14px;
    margin-bottom: 28px;
}

.app-stat-card {
    background: var(--b-surface);
    border-radius: var(--r);
    padding: 20px 18px;
    border: 1px solid var(--b-border);
    text-align: center;
    position: relative;
    overflow: hidden;
    transition: border-color 0.2s;
}

    .app-stat-card:hover {
        border-color: var(--b-accent-glow);
    }

    .app-stat-card::after {
        content: '';
        position: absolute;
        bottom: -25px;
        right: -25px;
        width: 80px;
        height: 80px;
        background: radial-gradient(circle, var(--b-accent-dim) 0%, transparent 70%);
        pointer-events: none;
    }

body[data-app-theme="light"] .app-stat-card::after {
    background: radial-gradient(circle, var(--b-accent-glow) 0%, transparent 65%);
}

.app-stat-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
    opacity: 0.85;
}

.app-stat-value {
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 2.8rem;
    font-weight: 800;
    color: var(--b-accent);
    line-height: 1;
    margin-bottom: 5px;
}

.app-stat-label {
    font-size: 0.68rem;
    color: var(--b-text-2);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ── Table / page header ─────────────────────────────────────────────────── */
.app-table-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.app-page-title {
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 2rem;
    font-weight: 800;
    color: var(--b-text);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1;
}

/* ── Status badges ───────────────────────────────────────────────────────── */
.app-badge-active {
    background: rgba(74,222,128,0.12);
    color: #4ADE80;
    border: 1px solid rgba(74,222,128,0.25);
    border-radius: var(--r-pill);
    padding: 3px 12px;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.app-badge-inactive {
    background: rgba(255,255,255,0.05);
    color: var(--b-text-3);
    border: 1px solid var(--b-border);
    border-radius: var(--r-pill);
    padding: 3px 12px;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

body[data-app-theme="light"] .app-badge-inactive {
    background: rgba(0,0,0,0.04);
    color: var(--b-text-2);
}

/* ── Detail card ─────────────────────────────────────────────────────────── */
.app-detail-card {
    background: var(--b-surface);
    border-radius: var(--r);
    padding: 28px;
    border: 1px solid var(--b-border);
    max-width: 620px;
}

.app-detail-header {
    position: relative;
    background: var(--b-surface);
    border-radius: var(--r);
    padding: 24px;
    margin-bottom: 16px;
    border: 1px solid var(--b-accent-glow);
    overflow: hidden;
}

    .app-detail-header::before {
        content: '';
        position: absolute;
        top: -40px;
        right: -40px;
        width: 160px;
        height: 160px;
        background: radial-gradient(circle, var(--b-accent-dim) 0%, transparent 65%);
        pointer-events: none;
    }

.app-detail-label {
    font-size: 0.65rem;
    color: var(--b-text-3);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: 700;
    margin-bottom: 3px;
}

.app-detail-value {
    font-size: 0.92rem;
    color: var(--b-text);
    margin-bottom: 18px;
    font-weight: 500;
    line-height: 1.4;
}

/* ── Sidebar user section ────────────────────────────────────────────────── */
.app-sidebar-user {
    margin-top: auto;
    padding: 14px 12px;
    border-top: 1px solid var(--b-border);
    display: flex;
    align-items: center;
    gap: 8px;
}

.app-sidebar-avatar {
    background: var(--b-accent-dim);
    border: 1px solid var(--b-accent-glow);
    color: var(--b-accent);
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 700;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    user-select: none;
}

.app-sidebar-user-name {
    flex: 1;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-size: 0.78rem;
    color: var(--b-text-2);
}

/* ─── Header hamburger — left-padding aligns icon center with sidebar icons ── */
.app-hamburger {
    padding-left: 10px !important;
    padding-right: 10px !important;
}

/* ─── SfSidebar shell ────────────────────────────────────────────────────── */
.app-sf-sidebar.e-sidebar {
    border-right: 1px solid var(--b-border) !important;
    box-shadow: none !important;
    overflow: hidden !important;
}

body[data-app-theme="dark"] .app-sf-sidebar.e-sidebar {
    border-right-color: rgba(0, 215, 102, 0.14) !important;
}

body[data-app-theme="dark"] .app-sf-sidebar-inner {
    position: relative;
}

    body[data-app-theme="dark"] .app-sf-sidebar-inner::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        height: 200px;
        background: radial-gradient(ellipse at 50% -30%, rgba(0,215,102,0.13) 0%, transparent 70%);
        pointer-events: none;
        z-index: 0;
    }

    /* Ensure nav items sit above the glow pseudo-element */
    body[data-app-theme="dark"] .app-sf-sidebar-inner > * {
        position: relative;
        z-index: 1;
    }

/* Stronger active + hover in dark mode */
body[data-app-theme="dark"] .app-nav-list-item.is-active {
    background: rgba(0, 215, 102, 0.16) !important;
    border-left-color: #00D766 !important;
    color: #00D766 !important;
}

body[data-app-theme="dark"] .app-nav-list-item:hover:not(.is-active) {
    background: rgba(0, 215, 102, 0.08) !important;
}

.app-sf-sidebar-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    background: var(--b-surface);
}

/* ─── Brand row inside sidebar ────────────────────────────────────────────── */
.app-sf-sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 14px 12px;
    border-bottom: 1px solid var(--b-border);
    margin-bottom: 4px;
    flex-shrink: 0;
}

.app-sf-brand-name {
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--b-text);
    white-space: nowrap;
}

/* ─── SfListView nav strip ────────────────────────────────────────────────── */
.app-nav-list.e-listview {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
}

.app-nav-list .e-list-item,
.app-nav-list .e-list-item:hover,
.app-nav-list .e-list-item.e-active,
.app-nav-list .e-list-item.e-focused {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    height: auto !important;
    line-height: unset !important;
    outline: none !important;
    box-shadow: none !important;
}

    .app-nav-list .e-list-item .e-list-wrapper {
        padding: 0 !important;
        height: auto !important;
    }

/* ─── Hamburger row (toggle at top of sidebar) ────────────────────────────── */
.app-nav-toggle {
    border-bottom: 1px solid var(--b-border);
    margin-bottom: 4px;
}

.app-brand-name {
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--b-text);
}

/* ─── Header hamburger — aligned with sidebar icon column ─────────────────── */
.app-hamburger {
    padding-left: 10px !important;
    padding-right: 10px !important;
}

/* ─── Individual nav item ─────────────────────────────────────────────────── */
.app-nav-list-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 11px 16px;
    cursor: pointer;
    color: var(--b-text-2);
    font-size: 14px;
    font-weight: 500;
    font-family: 'Barlow', sans-serif;
    border-left: 3px solid transparent;
    transition: color 0.15s, background 0.15s, border-left-color 0.15s;
    user-select: none;
}

    .app-nav-list-item:hover {
        background: var(--b-accent-dim);
        color: var(--b-text);
    }

    .app-nav-list-item.is-active {
        background: var(--b-accent-dim);
        border-left-color: var(--b-accent);
        color: var(--b-accent);
        font-weight: 600;
    }

.app-nav-icon {
    font-size: 17px;
    flex-shrink: 0;
    width: 20px;
    text-align: center;
}

/* ─── Mini sidebar (icon-rail, desktop only) ─────────────────────────────── */
.app-sf-sidebar-inner.is-mini .app-nav-label {
    display: none !important;
}

.app-sf-sidebar-inner.is-mini .app-nav-list-item {
    justify-content: center;
    padding: 11px 0;
    overflow: hidden;
}

.app-sf-sidebar-inner.is-mini .app-nav-icon {
    width: auto;
    font-size: 17px;
    flex-shrink: 0;
}

/* ─── Sidebar push — adjust main content ─────────────────────────────────── */
#app-body {
    position: relative;
}

    #app-body .app-main {
        transition: margin-left 0.3s ease;
    }

/* ─── Filter chips ────────────────────────────────────────────────────────── */
.app-filter-chips {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.app-filter-chip {
    padding: 5px 16px;
    border-radius: var(--r-pill);
    border: 1px solid var(--b-border);
    background: var(--b-surface);
    color: var(--b-text-2);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

    .app-filter-chip.active {
        border-color: var(--b-accent);
        color: var(--b-accent);
        background: var(--b-accent-dim);
    }

body[data-app-theme="light"] .app-filter-chip.active {
    background: var(--b-accent-dim);
    color: var(--b-accent);
}

/* ─── Surface card ────────────────────────────────────────────────────────── */
.b-card {
    background: var(--b-surface);
    border-radius: var(--r);
    border: 1px solid var(--b-border);
}

/* ─── Progress bar ────────────────────────────────────────────────────────── */
.b-progress {
    height: 4px;
    background: var(--b-surface-2);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 16px;
    position: relative;
}

    .b-progress::after {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        height: 100%;
        width: 40%;
        background: var(--b-accent);
        border-radius: 4px;
        animation: b-progress-slide 1.2s ease-in-out infinite;
    }

@keyframes b-progress-slide {
    0% {
        transform: translateX(-150%);
    }

    100% {
        transform: translateX(400%);
    }
}

/* ─── Inline error message ────────────────────────────────────────────────── */
.b-error-msg {
    color: var(--b-danger);
    background: rgba(255,71,87,0.10);
    border: 1px solid rgba(255,71,87,0.25);
    border-radius: var(--r-sm);
    padding: 8px 12px;
    font-size: 13px;
    margin-bottom: 8px;
}

/* ─── Dialog overlay ──────────────────────────────────────────────────────── */
.b-dialog-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.6);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ─── b-btn — outline button ─────────────────────────────────────────────── */
.b-btn {
    font-family: 'Barlow', sans-serif;
    font-size: 14px;
    font-weight: 500;
    line-height: 1;
    padding: 10px 20px;
    border-radius: var(--r-sm);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: background .15s ease, color .15s ease, border-color .15s ease;
}

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

    .b-btn-outline:hover {
        background: var(--b-accent-dim);
        color: var(--b-accent);
    }

    .b-btn-outline:active {
        transform: translateY(1px);
    }

.b-btn-secondary {
    color: var(--b-text);
    background: var(--b-surface-2);
    border: 1px solid var(--b-accent);
    font-size: 12px;
    padding: 8px 16px;
    border-radius: var(--r-sm);
}

    .b-btn-secondary:hover:not(:disabled) {
        background: var(--b-surface-3);
    }

/* ─── SfButton — minimum dimensions ─────────────────────────────────────── */
.e-btn:not(.e-icon-btn) {
    min-height: 35px !important;
    min-width: 90px !important;
}

/* ─── SfButton — primary uses accent green ───────────────────────────────── */
.e-btn.e-primary,
.e-btn.e-primary:focus {
    background: var(--b-accent) !important;
    border-color: var(--b-accent) !important;
    color: #fff !important;
}

    .e-btn.e-primary:hover {
        background: var(--b-accent) !important;
        border-color: var(--b-accent) !important;
        color: #fff !important;
        opacity: 0.88;
    }

body[data-app-theme="dark"] .e-btn.e-primary,
body[data-app-theme="dark"] .e-btn.e-primary:focus,
body[data-app-theme="dark"] .e-btn.e-primary:hover {
    color: #0D1810 !important;
}

/* ─── SfButton — icons always inherit button colour ──────────────────────── */
.e-btn .e-btn-icon,
.e-btn .e-btn-icon.e-icons {
    font-family: 'e-icons' !important;
    color: inherit !important;
    opacity: 1 !important;
    visibility: visible !important;
    display: inline-block !important;
    font-size: 14px !important;
    line-height: 1 !important;
}

    .e-btn .e-btn-icon::before,
    .e-btn .e-btn-icon.e-icons::before {
        font-family: 'e-icons' !important;
        color: inherit !important;
    }

/* ─── SfButton — flat / icon-only buttons ────────────────────────────────── */
.e-btn.e-flat {
    color: var(--b-text-2) !important;
    background: transparent !important;
    border-color: transparent !important;
}

    .e-btn.e-flat:hover {
        background: var(--b-accent-dim) !important;
        color: var(--b-text) !important;
        border-color: transparent !important;
    }

/* ─── Danger icon button ──────────────────────────────────────────────────── */
.b-btn-danger.e-btn {
    color: var(--b-danger) !important;
}

    .b-btn-danger.e-btn:hover {
        background: rgba(255,71,87,0.10) !important;
    }

/* ─── Header icon buttons ─────────────────────────────────────────────────── */
.app-header-btn {
    background: transparent;
    border: none;
    color: var(--b-text-2);
    cursor: pointer;
    padding: 6px;
    border-radius: var(--r-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s, background 0.2s;
}

    .app-header-btn:hover {
        color: var(--b-text);
        background: var(--b-surface-2);
    }

/* ─── Avatar button ───────────────────────────────────────────────────────── */
.app-avatar-btn {
    background: var(--b-accent-dim);
    border: 1px solid var(--b-accent-glow);
    color: var(--b-accent);
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 700;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    transition: background 0.2s, border-color 0.2s;
}

    .app-avatar-btn:hover {
        background: var(--b-accent-glow);
    }

/* ─── User dropdown ───────────────────────────────────────────────────────── */
.app-user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 220px;
    background: var(--b-surface);
    border: 1px solid var(--b-border);
    border-radius: var(--r);
    box-shadow: 0 8px 32px rgba(0,0,0,.4);
    z-index: 200;
    overflow: hidden;
}

.app-dropdown-item {
    width: 100%;
    text-align: left;
    background: transparent;
    border: none;
    color: var(--b-text);
    font-size: 13px;
    font-family: inherit;
    padding: 9px 16px;
    cursor: pointer;
    display: block;
    transition: background 0.15s;
}

    .app-dropdown-item:hover {
        background: var(--b-surface-2);
    }

.app-dropdown-signout {
    color: var(--b-danger);
}

/* ─── Settings overlay / panel ────────────────────────────────────────────── */
.app-settings-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 500;
    display: flex;
    align-items: stretch;
    justify-content: flex-end;
}

.app-settings-panel {
    width: 320px;
    max-width: 90vw;
    background: var(--b-surface);
    border-left: 1px solid var(--b-border);
    padding: 24px;
    overflow-y: auto;
}

/* ─── Quran Reader ─────────────────────────────────────────────────────────── */
:root {
    --qr-gold: #C8A951;
    --qr-gold-dim: rgba(200, 169, 81, 0.12);
}

.qr-sticky-header {
    position: sticky;
    top: -28px;
    z-index: 100;
    isolation: isolate;
    background: linear-gradient(to bottom, var(--b-bg) calc(100% - 32px), transparent 100%);
    padding: 28px 0 32px 0;
    max-width: 860px;
    margin: 0 auto;
}

    .qr-sticky-header > .qr-toolbar {
        margin-bottom: 24px;
    }

.qr-page {
    max-width: 860px;
    margin: 0 auto;
    padding-top: 0;
    padding-bottom: 60px;
}

.qr-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: var(--b-surface);
    border: 1px solid var(--b-border);
    border-radius: var(--r);
    padding: 12px 16px;
    flex-wrap: wrap;
}

.qr-toolbar-left,
.qr-toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.qr-select {
    background: var(--b-surface-2);
    border: 1px solid var(--b-border);
    color: var(--b-text);
    border-radius: var(--r-sm);
    padding: 7px 12px;
    font-family: 'Barlow', sans-serif;
    font-size: 0.87rem;
    cursor: pointer;
    outline: none;
    transition: border-color 0.15s;
}

    .qr-select:focus {
        border-color: var(--b-accent);
    }

.qr-nav-btn {
    background: var(--b-surface-2);
    border: 1px solid var(--b-border);
    color: var(--b-text-2);
    border-radius: var(--r-sm);
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: color 0.15s, background 0.15s;
    flex-shrink: 0;
}

    .qr-nav-btn:hover:not(:disabled) {
        background: var(--b-accent-dim);
        color: var(--b-accent);
    }

    .qr-nav-btn:disabled {
        opacity: 0.3;
        cursor: not-allowed;
    }

.qr-surah-banner {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 20px;
    background: var(--b-surface);
    border: 1px solid rgba(200, 169, 81, 0.2);
    border-radius: var(--r);
    padding: 20px 24px;
    position: relative;
    overflow: hidden;
}

body[data-app-theme="light"] .qr-surah-banner {
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    border-color: rgba(200, 169, 81, 0.25);
    background: linear-gradient(135deg, #FFFFFF 0%, #FDF8EF 100%);
}

body[data-app-theme="light"] .app-stat-card {
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

body[data-app-theme="light"] .b-card {
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

body[data-app-theme="light"] .qr-toolbar {
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}

body[data-app-theme="light"] .qr-search-input-wrap {
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}

.qr-surah-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.qr-surah-banner::before {
    content: '';
    position: absolute;
    top: -40px;
    right: -40px;
    width: 180px;
    height: 180px;
    background: radial-gradient(circle, rgba(200,169,81,0.08) 0%, transparent 65%);
    pointer-events: none;
}

.qr-surah-number {
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 2.4rem;
    font-weight: 800;
    color: var(--qr-gold);
    flex-shrink: 0;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qr-surah-meta {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 32px;
    flex: 1;
}

.qr-surah-meta-left {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
}

.qr-surah-meta-right {
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.qr-surah-arabic {
    font-family: 'Amiri Quran', 'Amiri', serif;
    font-size: 1.8rem;
    color: var(--b-text);
    direction: rtl;
    line-height: 1.4;
}

.qr-surah-transliterated {
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--b-text);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.qr-surah-english {
    font-size: 0.82rem;
    color: var(--b-text-2);
}

.qr-surah-badges {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: flex-end;
}

.qr-badge {
    padding: 3px 12px;
    border-radius: var(--r-pill);
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    background: var(--b-surface-2);
    color: var(--b-text-2);
    border: 1px solid var(--b-border);
    white-space: nowrap;
}

.qr-badge-revelation {
    background: var(--qr-gold-dim);
    color: var(--qr-gold);
    border-color: rgba(200, 169, 81, 0.2);
}

.qr-bismillah {
    text-align: center;
    font-family: 'Amiri Quran', 'Amiri', serif;
    font-size: 2.2rem;
    color: var(--qr-gold);
    margin-bottom: 32px;
    line-height: 2;
    direction: rtl;
    padding: 12px 0;
    border-bottom: 1px solid rgba(200, 169, 81, 0.15);
}

.qr-ayahs {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.qr-ayah {
    background: var(--b-surface);
    border: 1px solid var(--b-border);
    border-radius: var(--r);
    padding: 20px 24px;
    transition: border-color 0.15s;
    scroll-margin-top: 240px;
}

    .qr-ayah:hover {
        border-color: rgba(200, 169, 81, 0.2);
    }

body[data-app-theme="light"] .qr-ayah {
    box-shadow: 0 2px 8px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    border-color: rgba(0, 0, 0, 0.10);
}

    body[data-app-theme="light"] .qr-ayah:hover {
        box-shadow: 0 4px 16px rgba(0,0,0,0.10), 0 2px 4px rgba(0,0,0,0.06);
        border-color: rgba(0, 159, 61, 0.25);
    }

.qr-ayah-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.qr-ayah-badge {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--qr-gold-dim);
    border: 1px solid rgba(200, 169, 81, 0.3);
    color: var(--qr-gold);
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 700;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.qr-ayah-badge-link {
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s;
}

    .qr-ayah-badge-link:hover {
        background: var(--qr-gold);
        border-color: var(--qr-gold);
        color: var(--b-surface);
    }

.qr-ayah-meta {
    font-size: 0.72rem;
    color: var(--b-text-3);
    font-weight: 500;
    letter-spacing: 0.5px;
}

.qr-ayah-arabic {
    font-family: 'Amiri Quran', 'Amiri', serif;
    font-size: 1.9rem;
    line-height: 2.2;
    direction: rtl;
    text-align: right;
    color: var(--b-text);
    margin-bottom: 14px;
}

/* Transliteration and translation share one type scale and leading so the two
   blocks read as the same rhythm, and mirror their padding around the divider
   so the rule sits centred between them instead of hugging the transliteration. */
.qr-ayah-transliteration,
.ayah-transliteration,
.qr-ayah-translation {
    font-size: 1.05rem;
    line-height: 1.85;
    margin: 0;
}

/* Same colour as .qr-ayah-arabic - the transliteration is the Arabic text,
   so it reads as primary content; only the translation is secondary. */
.qr-ayah-transliteration,
.ayah-transliteration {
    color: var(--b-text);
    padding-bottom: 9px;
}

.qr-ayah-translation {
    color: var(--b-text-2);
    border-top: 1px solid var(--b-border);
    padding-top: 9px;
    font-style: italic;
}

/* ── Search ───────────────────────────────────────────────────────────────── */
.qr-search-box {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 28px;
}

.qr-search-input-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--b-surface);
    border: 1px solid var(--b-border);
    border-radius: var(--r);
    padding: 0 16px;
    transition: border-color 0.15s;
}

    .qr-search-input-wrap:focus-within {
        border-color: var(--b-accent);
    }

.qr-search-icon {
    flex-shrink: 0;
    color: var(--b-text-3);
}

.qr-search-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--b-text);
    font-family: 'Barlow', sans-serif;
    font-size: 0.95rem;
    padding: 12px 0;
}

    .qr-search-input::placeholder {
        color: var(--b-text-3);
    }

body[data-app-theme="light"] .qr-search-input::placeholder {
    color: #9A9388;
}

/* The custom clear button below replaces the native one type="search" would draw. */
.qr-search-input::-webkit-search-cancel-button {
    -webkit-appearance: none;
    appearance: none;
}

.qr-search-submit {
    flex-shrink: 0;
    white-space: nowrap;
    color: #fff;
    background: var(--b-accent);
    border: 1px solid var(--b-accent);
}

    .qr-search-submit:disabled {
        opacity: .5;
        cursor: default;
    }

    .qr-search-submit:hover:not(:disabled) {
        filter: brightness(1.08);
    }

    .qr-search-submit:active:not(:disabled) {
        transform: translateY(1px);
    }

.qr-search-clear {
    flex-shrink: 0;
    background: none;
    border: none;
    color: var(--b-text-3);
    cursor: pointer;
    padding: 4px;
    border-radius: var(--r-sm);
    display: flex;
    align-items: center;
    transition: color 0.15s, background 0.15s;
}

    .qr-search-clear:hover {
        color: var(--b-text);
        background: var(--b-surface-2);
    }

.qr-search-summary {
    font-size: 0.82rem;
    color: var(--b-text-3);
    margin-bottom: 16px;
}

.qr-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 10px 0;
    width: fit-content;
    margin: 0 auto;
}

.qr-pagination-info {
    font-size: 0.85rem;
    color: var(--b-text-3);
    white-space: nowrap;
}

.qr-pagination .b-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.qr-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}

.qr-empty-icon {
    margin-bottom: 16px;
    color: var(--b-text-3);
}

.qr-empty-text {
    font-size: 0.95rem;
    color: var(--b-text-3);
}

.qr-surah-link {
    color: var(--qr-gold);
    text-decoration: none;
    font-weight: 600;
    transition: opacity 0.15s;
}

    .qr-surah-link:hover {
        opacity: 0.8;
        text-decoration: underline;
    }
