/*
 * SIPESAT Native Polish
 * Final cascade layer loaded after page/nav inline styles.
 * UI only: no endpoint, form action, data attribute, or business rule changes.
 */

:root {
    --sipesat-nav-height: 76px;
    --sipesat-sticky-z: 1020;
    --sipesat-nav-z: 1030;
    --sipesat-offcanvas-z: 1045;
    --sipesat-modal-z: 1055;
    --sipesat-sheet-z: 1070;
    --sipesat-chat-z: 1100;
}

body:not(.login-page-body):not(.pelayanan-mandiri-body) {
    background-color: var(--ios-bg);
}

body.native-ui-ready {
    text-rendering: geometricPrecision;
}

body.native-ui-ready :where(.card, .form-card, .history-card, .notif-card, .quick-action-card, .feature-card) {
    transition: transform 180ms var(--ios-ease), box-shadow 220ms ease, border-color 180ms ease, background-color 180ms ease;
}

/* Keep content inside every app viewport without clipping useful scroll areas. */
body:not(.mira-widget-shell) :where(.main-content, .content, .app-container, .container, .container-fluid) {
    max-width: 100%;
}

body:not(.mira-widget-shell) :where(.card-body, .modal-body, .offcanvas-body, .accordion-body, .list-group-item) {
    overflow-wrap: anywhere;
}

body:not(.mira-widget-shell) :where(.table-responsive, .dataTables_wrapper) {
    max-width: 100%;
}

.dataTables_wrapper .row {
    row-gap: 10px;
}

.dataTables_wrapper :where(.dataTables_filter input, .dataTables_length select) {
    min-height: 38px;
    border-radius: 12px !important;
}

.pagination {
    flex-wrap: wrap;
    gap: 5px;
}

.page-link {
    min-width: 38px;
    min-height: 38px;
    color: var(--ios-text-secondary);
    font-weight: 700;
    border-color: var(--ios-card-border);
    border-radius: 11px !important;
}

.page-item.active .page-link {
    color: #ffffff;
    background: linear-gradient(135deg, var(--ios-blue-deep), var(--ios-blue));
    border-color: transparent;
    box-shadow: var(--ios-shadow-blue);
}

/* Native bottom navigation — deliberately scoped to avoid Bootstrap .nav-item leaks. */
html body .bottom-nav {
    isolation: isolate;
    z-index: var(--sipesat-nav-z) !important;
    background: rgba(255, 255, 255, 0.9) !important;
    border: 1px solid rgba(15, 35, 71, 0.1) !important;
    box-shadow: 0 18px 52px rgba(15, 35, 71, 0.18), 0 2px 10px rgba(15, 35, 71, 0.06) !important;
    backdrop-filter: blur(26px) saturate(185%) !important;
    -webkit-backdrop-filter: blur(26px) saturate(185%) !important;
}

html body .bottom-nav > .nav-item {
    min-width: 0 !important;
    color: #718096 !important;
    text-decoration: none !important;
}

html body .bottom-nav > .nav-item > i {
    color: currentColor !important;
    transition: transform 180ms var(--ios-ease-spring), color 180ms ease !important;
}

html body .bottom-nav > .nav-item.active {
    color: var(--ios-blue) !important;
}

html body .bottom-nav > .nav-item.active > i {
    transform: translateY(-1px) scale(1.06);
}

html body.dark-mode .bottom-nav {
    background: rgba(8, 21, 39, 0.9) !important;
    border-color: rgba(125, 183, 255, 0.15) !important;
    box-shadow: 0 20px 58px rgba(0, 0, 0, 0.48), 0 0 32px rgba(37, 99, 235, 0.08) !important;
}

html body.dark-mode .bottom-nav > .nav-item {
    color: #91a4bc !important;
}

html body.dark-mode .bottom-nav > .nav-item.active {
    color: #72b5ff !important;
}

html body.dark-mode .bottom-nav .native-center-label {
    color: #d7e5f5 !important;
}

html body.dark-mode .bottom-nav .btn-center {
    border-color: rgba(255, 255, 255, 0.72) !important;
    box-shadow: 0 14px 34px rgba(30, 100, 220, 0.42) !important;
}

/* Bottom sheets: one visual language for signed-in and guest launchers. */
html body .custom-bottom-sheet {
    z-index: var(--sipesat-sheet-z) !important;
}

html body .bottom-sheet-backdrop {
    background: rgba(8, 18, 35, 0.56) !important;
    backdrop-filter: blur(9px) saturate(120%);
    -webkit-backdrop-filter: blur(9px) saturate(120%);
}

html body .bottom-sheet-content {
    color: var(--ios-text) !important;
    background: rgba(255, 255, 255, 0.96) !important;
    border: 1px solid rgba(255, 255, 255, 0.88) !important;
    border-radius: 30px 30px 0 0 !important;
    box-shadow: 0 -24px 72px rgba(15, 35, 71, 0.22) !important;
    overscroll-behavior: contain;
}

html body .bottom-sheet-drag-handle {
    position: relative !important;
    width: 48px !important;
    height: 5px !important;
    min-height: 5px !important;
    background: #cbd5e1 !important;
    cursor: grab !important;
    touch-action: none !important;
}

html body .bottom-sheet-drag-handle::before {
    position: absolute;
    inset: -14px -36px;
    content: "";
}

html body .bottom-sheet-drag-handle:active,
html body .bottom-sheet-drag-handle.is-dragging {
    width: 58px !important;
    background: #8fa1b8 !important;
    cursor: grabbing !important;
}

html body .bottom-sheet-title {
    color: #10213f !important;
}

html body .bottom-sheet-subtitle,
html body .bottom-sheet-label {
    color: #60708a !important;
}

html body .bottom-sheet-item {
    min-width: 0;
    color: #243551 !important;
}

html body .bottom-sheet-close-native,
html body #btn-close-bottom-sheet {
    min-width: 40px;
    min-height: 40px;
    color: #64748b !important;
    background: #f1f5f9 !important;
    border: 1px solid rgba(100, 116, 139, 0.08) !important;
    border-radius: 13px !important;
}

html body.dark-mode .bottom-sheet-content {
    color: #f7fbff !important;
    background: linear-gradient(155deg, rgba(14, 34, 59, 0.98), rgba(7, 20, 38, 0.98)) !important;
    border-color: rgba(125, 183, 255, 0.14) !important;
    box-shadow: 0 -28px 76px rgba(0, 0, 0, 0.58), 0 0 46px rgba(37, 99, 235, 0.08) !important;
}

html body.dark-mode .bottom-sheet-drag-handle {
    background: #536984 !important;
}

html body.dark-mode .bottom-sheet-header {
    border-color: rgba(148, 197, 255, 0.1) !important;
}

html body.dark-mode .bottom-sheet-title {
    color: #f8fbff !important;
}

html body.dark-mode .bottom-sheet-subtitle,
html body.dark-mode .bottom-sheet-label {
    color: #b5c5d9 !important;
}

html body.dark-mode .bottom-sheet-item:not(.bottom-sheet-item--featured) {
    color: #eaf3ff !important;
    background: rgba(20, 45, 75, 0.72) !important;
    border-color: rgba(125, 183, 255, 0.11) !important;
}

html body.dark-mode .bottom-sheet-close-native,
html body.dark-mode #btn-close-bottom-sheet {
    color: #dcecff !important;
    background: rgba(125, 183, 255, 0.1) !important;
    border-color: rgba(125, 183, 255, 0.12) !important;
}

html body.dark-mode #bottom-sheet-search-input {
    color: #f7fbff !important;
    background: rgba(5, 16, 31, 0.72) !important;
    border-color: rgba(125, 183, 255, 0.14) !important;
}

/* Admin shell */
html body #adminSidebar {
    border-right: 1px solid rgba(15, 35, 71, 0.08) !important;
    box-shadow: 18px 0 54px -34px rgba(15, 35, 71, 0.36) !important;
}

html body #adminSidebar .list-group-item {
    min-height: 46px;
    margin: 2px 10px;
    border-radius: 13px !important;
    transition: transform 140ms var(--ios-ease), background-color 170ms ease, color 170ms ease !important;
}

html body #adminSidebar .list-group-item:not(.bg-primary):not([style*="gradient"]) {
    border: 0 !important;
}

html body #adminSidebar .list-group-item:active {
    transform: scale(0.975);
}

html body nav.navbar.sticky-top {
    border-bottom: 1px solid rgba(15, 35, 71, 0.08) !important;
    box-shadow: 0 10px 34px -24px rgba(15, 35, 71, 0.32) !important;
    backdrop-filter: blur(22px) saturate(160%);
    -webkit-backdrop-filter: blur(22px) saturate(160%);
}

html body #desktopToggleBtn {
    border: 1px solid rgba(255, 255, 255, 0.28) !important;
    box-shadow: 0 12px 28px -16px rgba(10, 122, 255, 0.62) !important;
}

/* SweetAlert, Intro.js, and common overlays must remain readable in both modes. */
html body .swal2-popup {
    color: #14213a !important;
    background: rgba(255, 255, 255, 0.98) !important;
    border: 1px solid rgba(15, 35, 71, 0.09) !important;
    border-radius: 26px !important;
    box-shadow: 0 30px 90px rgba(15, 35, 71, 0.3) !important;
}

html body .swal2-popup :where(.swal2-title, .swal2-html-container) {
    color: #14213a !important;
}

html body.dark-mode .swal2-popup {
    color: #f7fbff !important;
    background: linear-gradient(155deg, #102641, #09182c) !important;
    border-color: rgba(125, 183, 255, 0.15) !important;
}

html body.dark-mode .swal2-popup :where(.swal2-title, .swal2-html-container) {
    color: #f7fbff !important;
}

html body.dark-mode .introjs-tooltip {
    color: #f7fbff !important;
    background: #102641 !important;
    border: 1px solid rgba(125, 183, 255, 0.14) !important;
}

/* MIRA is a deliberately light, WhatsApp-like surface inside either app theme. */
html body.dark-mode #chatbot-box {
    color: #1e293b !important;
    color-scheme: light !important;
    background-color: #ffffff !important;
}

html body.dark-mode #chatbot-box :where(#input-pesan-user, input:not([type="checkbox"]):not([type="radio"]), textarea, select) {
    color: #0f172a !important;
    background-color: transparent !important;
    border-color: transparent !important;
}

html body.dark-mode #chatbot-box :where(#emoji-drawer, #emoji-grid) {
    color: #1e293b !important;
    color-scheme: light !important;
    background-color: #ffffff !important;
}

/* BerandaApp — native launcher on mobile, structured command center on desktop. */
body.beranda-app-page {
    background-color: #f3f6fb !important;
    background-image:
        radial-gradient(circle at 8% -8%, rgba(10, 122, 255, 0.11), transparent 30rem),
        radial-gradient(circle at 95% 18%, rgba(56, 189, 248, 0.08), transparent 26rem) !important;
    background-attachment: fixed !important;
}

body.beranda-app-page .app-container {
    width: min(100%, 1120px) !important;
    padding: 0 clamp(14px, 3vw, 28px) !important;
}

body.beranda-app-page .beranda-command-bar {
    position: sticky;
    top: 0;
    z-index: var(--sipesat-sticky-z);
    min-height: 54px;
    margin: 0 calc(clamp(14px, 3vw, 28px) * -0.3) 10px;
    padding: 8px 10px !important;
    background: rgba(243, 246, 251, 0.78);
    border: 1px solid rgba(255, 255, 255, 0.6) !important;
    border-radius: 0 0 18px 18px;
    backdrop-filter: blur(22px) saturate(175%);
    -webkit-backdrop-filter: blur(22px) saturate(175%);
}

body.beranda-app-page .premium-greeting-header {
    position: relative;
    isolation: isolate;
    gap: 18px;
    margin: 12px 0 26px;
    padding: clamp(20px, 4vw, 34px) !important;
    overflow: hidden;
    background:
        radial-gradient(circle at 88% 12%, rgba(56, 189, 248, 0.24), transparent 15rem),
        linear-gradient(135deg, #0b2f6f 0%, #1557b7 55%, #0a7aff 100%) !important;
    border: 1px solid rgba(255, 255, 255, 0.22) !important;
    border-radius: clamp(24px, 4vw, 34px) !important;
    box-shadow: 0 28px 65px -32px rgba(15, 70, 165, 0.72), inset 0 1px rgba(255, 255, 255, 0.15);
}

body.beranda-app-page .premium-greeting-header::after {
    position: absolute;
    top: -80px;
    right: -55px;
    z-index: -1;
    width: 190px;
    height: 190px;
    content: "";
    border: 28px solid rgba(255, 255, 255, 0.07);
    border-radius: 50%;
}

body.beranda-app-page .premium-greeting-header :where(.greeting-title, .greeting-name, .greeting-subtext) {
    color: #ffffff !important;
}

body.beranda-app-page .premium-greeting-header .greeting-title,
body.beranda-app-page .premium-greeting-header .greeting-subtext {
    color: rgba(255, 255, 255, 0.76) !important;
}

body.beranda-app-page .premium-greeting-header .greeting-name {
    font-size: clamp(1.35rem, 4vw, 2.1rem) !important;
    letter-spacing: -0.04em;
}

body.beranda-app-page .premium-greeting-header .badge {
    color: #113366 !important;
    background: rgba(255, 255, 255, 0.9) !important;
    border-color: rgba(255, 255, 255, 0.62) !important;
}

@media (max-width: 767.98px) {
    body.beranda-app-page .greeting-avatar {
        width: clamp(56px, 8vw, 76px) !important;
        height: clamp(56px, 8vw, 76px) !important;
        background: rgba(255, 255, 255, 0.16) !important;
        border: 2px solid rgba(255, 255, 255, 0.65) !important;
        box-shadow: 0 16px 34px rgba(4, 24, 62, 0.34) !important;
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
    }
}
@media (min-width: 768px) {
    body.beranda-app-page .greeting-avatar {
        display: none !important;
    }
}

body.beranda-app-page .beranda-notice-pill {
    max-width: 100%;
    color: #ffffff !important;
    background: rgba(255, 255, 255, 0.14) !important;
    border-color: rgba(255, 255, 255, 0.22) !important;
    box-shadow: none !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

body.beranda-app-page :where(.quick-access-section, .all-menu-section) {
    padding: clamp(16px, 3vw, 24px);
    background: rgba(255, 255, 255, 0.78);
    border: 1px solid rgba(15, 35, 71, 0.075);
    border-radius: 28px;
    box-shadow: var(--ios-shadow-sm);
    backdrop-filter: blur(18px) saturate(145%);
    -webkit-backdrop-filter: blur(18px) saturate(145%);
}

body.beranda-app-page .section-title {
    color: #52627b !important;
    font-size: 0.76rem !important;
    letter-spacing: 0.1em;
}

body.beranda-app-page .carousel-chip {
    min-height: 112px;
    background: rgba(255, 255, 255, 0.94) !important;
    border: 1px solid rgba(15, 35, 71, 0.075) !important;
    box-shadow: 0 12px 28px -22px rgba(15, 35, 71, 0.48) !important;
}

body.beranda-app-page .mobile-grid-card {
    min-width: 0;
    min-height: 90px;
    border-radius: 17px !important;
}

body.beranda-app-page .mobile-grid-icon {
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.36), 0 10px 24px -18px currentColor;
}

body.beranda-app-page .mobile-grid-label {
    width: 100%;
    color: #243551 !important;
    font-size: clamp(0.64rem, 2.7vw, 0.75rem) !important;
}

body.beranda-app-page .classic-dashboard-card {
    padding: clamp(17px, 3vw, 24px) !important;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(232, 243, 255, 0.94)) !important;
    border-color: rgba(10, 122, 255, 0.14) !important;
    box-shadow: var(--ios-shadow-blue) !important;
}

body.dark-mode,
body.beranda-app-page.dark-mode {
    background-color: #07111f !important;
    background-image:
        radial-gradient(circle at 8% -8%, rgba(37, 99, 235, 0.34), transparent 34rem),
        radial-gradient(circle at 92% 22%, rgba(14, 165, 233, 0.15), transparent 28rem),
        radial-gradient(circle at 45% 112%, rgba(30, 64, 175, 0.19), transparent 40rem) !important;
    background-attachment: fixed !important;
}

body.beranda-app-page.dark-mode .beranda-command-bar {
    background: rgba(7, 17, 31, 0.78) !important;
    border-color: rgba(125, 183, 255, 0.1) !important;
}

body.beranda-app-page.dark-mode :where(.quick-access-section, .all-menu-section) {
    background: rgba(10, 26, 47, 0.76) !important;
    border-color: rgba(125, 183, 255, 0.1) !important;
    box-shadow: 0 24px 56px -38px rgba(0, 0, 0, 0.9) !important;
}

body.beranda-app-page.dark-mode .section-title {
    color: #b7c8dc !important;
}

body.beranda-app-page.dark-mode .carousel-chip {
    background: rgba(17, 39, 67, 0.9) !important;
    border-color: rgba(125, 183, 255, 0.11) !important;
}

body.beranda-app-page.dark-mode .mobile-grid-card:not(.has-badge) {
    background: transparent !important;
    border-color: transparent !important;
    box-shadow: none !important;
}

body.beranda-app-page.dark-mode .mobile-grid-card.has-badge {
    background: rgba(17, 39, 67, 0.78) !important;
}

body.beranda-app-page.dark-mode .mobile-grid-label,
body.beranda-app-page.dark-mode .carousel-label {
    color: #eef6ff !important;
}

body.beranda-app-page.dark-mode .classic-dashboard-card {
    background: linear-gradient(135deg, rgba(18, 46, 80, 0.96), rgba(10, 30, 55, 0.96)) !important;
    border-color: rgba(77, 163, 255, 0.18) !important;
}

body.beranda-app-page.dark-mode .classic-dashboard-title {
    color: #8cc5ff !important;
}

body.beranda-app-page.dark-mode #kioskMandiriModal .modal-content,
body.beranda-app-page.dark-mode #kioskMandiriModal .modal-footer,
body.beranda-app-page.dark-mode #kioskMandiriModal .kiosk-upload-box {
    color: #f7fbff !important;
    background: #0d2038 !important;
    border-color: rgba(125, 183, 255, 0.13) !important;
}

body.beranda-app-page.dark-mode #kioskMandiriModal :where(.modal-title, #label-kiosk-file, label) {
    color: #f7fbff !important;
}

/* Standalone public pages inherit the same safe theme without touching print views. */
body.sipesat-standalone-page {
    min-height: 100svh;
    min-height: 100dvh;
    background-color: var(--ios-bg) !important;
}

body.sipesat-standalone-page.dark-mode {
    background-color: #07111f !important;
}

body.sipesat-standalone-page :where(.container, .container-fluid, main) {
    max-width: 1180px;
}

body:is(.klaim-akun-page, .lupa-password-page) .card-login {
    max-width: 100%;
    box-shadow: 0 30px 78px -30px rgba(15, 58, 138, 0.45), inset 0 1px rgba(255, 255, 255, 0.72) !important;
}

body:is(.klaim-akun-page, .lupa-password-page).dark-mode .full-bg-overlay {
    background: linear-gradient(145deg, rgba(2, 10, 24, 0.78), rgba(10, 43, 88, 0.68)) !important;
    backdrop-filter: blur(26px) saturate(130%) !important;
    -webkit-backdrop-filter: blur(26px) saturate(130%) !important;
}

body:is(.klaim-akun-page, .lupa-password-page).dark-mode .card-login {
    color: #f7fbff !important;
    background: linear-gradient(150deg, rgba(14, 34, 59, 0.94), rgba(7, 20, 38, 0.94)) !important;
    border-color: rgba(125, 183, 255, 0.16) !important;
    box-shadow: 0 34px 88px -34px rgba(0, 0, 0, 0.88), inset 0 1px rgba(255, 255, 255, 0.06) !important;
}

body:is(.klaim-akun-page, .lupa-password-page).dark-mode .text-academic {
    background: linear-gradient(135deg, #ffffff, #72b5ff) !important;
    -webkit-background-clip: text !important;
    background-clip: text !important;
}

body:is(.klaim-akun-page, .lupa-password-page).dark-mode .input-group-custom .form-control {
    color: #f7fbff !important;
    background: rgba(6, 18, 35, 0.78) !important;
    border-color: rgba(125, 183, 255, 0.2) !important;
}

body:is(.klaim-akun-page, .lupa-password-page).dark-mode :where(.radar-box, .step-guide, .alert-light) {
    color: #c9d8ea !important;
    background: rgba(77, 163, 255, 0.075) !important;
    border-color: rgba(125, 183, 255, 0.15) !important;
}

body:is(.klaim-akun-page, .lupa-password-page).dark-mode .desktop-border-divider {
    border-color: rgba(125, 183, 255, 0.14) !important;
}

/* Documentation page uses its own semantic tokens; remap them rather than repainting every child. */
body.panduan-page.dark-mode {
    --text-primary: #f7fbff;
    --text-body: #c7d5e7;
    --text-secondary: #a9bad0;
    --text-muted: #8197b2;
    --bg-main: #07111f;
    --bg-sidebar: #0b192b;
    --surface-1: #10243d;
    --surface-2: #173453;
    --surface-hover: #132b49;
    --border-light: rgba(125, 183, 255, 0.1);
    --border-medium: rgba(125, 183, 255, 0.16);
    --border-accent: rgba(77, 163, 255, 0.42);
    --shadow-sm: 0 4px 18px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 14px 36px rgba(0, 0, 0, 0.28);
    --shadow-lg: 0 26px 62px rgba(0, 0, 0, 0.34);
}

body.panduan-page.dark-mode :where(.mobile-topbar, .desktop-topbar, .sidebar, .doc-section, .info-card, .contact-card, .ai-demo, .interactive-tte-widget) {
    color: var(--text-body) !important;
    background-color: var(--bg-sidebar) !important;
    border-color: var(--border-light) !important;
}

body.panduan-page.dark-mode :where(.brand-name, .hero-banner h1, .doc-section h1, .doc-section h2, .doc-section h3, .info-card h3) {
    color: var(--text-primary) !important;
}

body.panduan-page.dark-mode :where(.content-scroll, .app-shell) {
    background-color: transparent !important;
}

/* The manga pages are intentionally light paper, even when the ambient shell is navy. */
body.kisah-page.dark-mode .page,
body.kisah-page.dark-mode .comic-panel,
body.kisah-page.dark-mode .speech-bubble,
body.kisah-page.dark-mode .spoiler-card {
    color: #111111 !important;
    color-scheme: light !important;
}

body.kisah-page.dark-mode .page :where(p, small, .small, .text-muted, .text-secondary) {
    color: #202020 !important;
}

body.kisah-page.dark-mode .page--cover .cover-title {
    color: #ffffff !important;
}

body.kisah-page.dark-mode .book-container {
    filter: drop-shadow(0 24px 52px rgba(0, 0, 0, 0.46)) drop-shadow(0 0 30px rgba(56, 189, 248, 0.12));
}

body.validasi-surat-page .validation-card {
    max-width: 100%;
    border-color: var(--ios-card-border) !important;
    box-shadow: var(--ios-shadow) !important;
}

body.validasi-surat-page .header-pattern .verify-brand-title,
body.validasi-surat-page.dark-mode .header-pattern .verify-brand-title {
    color: #ffffff !important;
}

body.validasi-surat-page .header-pattern .verify-brand-subtitle,
body.validasi-surat-page.dark-mode .header-pattern .verify-brand-subtitle {
    color: rgba(255, 255, 255, 0.78) !important;
}

body.validasi-surat-page.dark-mode .validation-card {
    color: #f7fbff !important;
    background: rgba(12, 29, 51, 0.94) !important;
    border-color: rgba(125, 183, 255, 0.13) !important;
}

body.validasi-surat-page.dark-mode .status-icon {
    background: #102743 !important;
}

body.validasi-surat-page.dark-mode :where(.detail-row, .bg-light) {
    background-color: rgba(16, 39, 67, 0.72) !important;
    border-color: rgba(125, 183, 255, 0.11) !important;
}

body.validasi-surat-page.dark-mode .verification-details {
    background: rgba(7, 23, 43, 0.72) !important;
}

body.validasi-surat-page.dark-mode .detail-row {
    background: rgba(18, 43, 72, 0.92) !important;
}

body.validasi-surat-page.dark-mode .label-detail {
    color: #9db0c8 !important;
}

body.validasi-surat-page.dark-mode .value-detail {
    color: #f1f7ff !important;
}

body.validasi-surat-page.dark-mode :where(.validation-description, .validation-state-message p, .validation-footer) {
    color: #aebfd3 !important;
}

@media (max-width: 575.98px), (max-device-width: 900px), (hover: none) and (pointer: coarse) {
    body.validasi-surat-page .validation-shell,
    body.validasi-surat-page .validation-card {
        width: 100% !important;
        max-width: none !important;
    }

    body.validasi-surat-page .validation-card {
        min-height: calc(100dvh - 42px) !important;
        border: 0 !important;
        border-radius: 0 !important;
        box-shadow: none !important;
    }

    body.validasi-surat-page.dark-mode,
    body.validasi-surat-page.dark-mode .validation-shell,
    body.validasi-surat-page.dark-mode .validation-footer {
        background: #071629 !important;
    }

    body.validasi-surat-page.dark-mode .validation-card {
        background: linear-gradient(180deg, #0a1d35 0%, #071629 100%) !important;
    }
}

/* Chat iframe is intentionally locked to a transparent/light canvas. */
body.mira-widget-shell,
body.mira-widget-shell.dark-mode {
    color-scheme: light !important;
    background: transparent !important;
    background-image: none !important;
}

body.mira-widget-shell #chatbot-box {
    color-scheme: light !important;
}

@media (min-width: 768px) {
    body.beranda-app-page .mobile-grid-launcher {
        grid-template-columns: repeat(6, minmax(0, 1fr)) !important;
        gap: 14px !important;
    }

    body.beranda-app-page .mobile-grid-card {
        padding: 14px 8px !important;
    }

    body.beranda-app-page .mobile-grid-icon {
        width: 50px !important;
        height: 50px !important;
        border-radius: 15px !important;
        font-size: 1.3rem !important;
    }
}

@media (min-width: 1024px) {
    body.beranda-app-page :where(.quick-access-section, .all-menu-section) {
        padding: 26px 30px;
    }

    body.beranda-app-page .premium-greeting-header {
        min-height: 190px;
    }

    body.beranda-app-page .mobile-grid-launcher {
        grid-template-columns: repeat(7, minmax(0, 1fr)) !important;
    }
}

@media (max-width: 767.98px) {
    body:not(.mira-widget-shell) {
        padding-bottom: calc(var(--sipesat-nav-height) + var(--ios-safe-bottom));
    }

    body.beranda-app-page .premium-greeting-header {
        align-items: flex-start !important;
    }

    body.beranda-app-page .beranda-command-bar {
        margin-bottom: 8px;
    }

    html body .bottom-sheet-content {
        width: 100% !important;
        max-width: 100% !important;
        max-height: min(88dvh, 760px) !important;
        padding-bottom: calc(22px + env(safe-area-inset-bottom)) !important;
    }
}

@media (max-width: 374.98px) {
    body.beranda-app-page .beranda-command-bar {
        gap: 6px;
    }

    body.beranda-app-page .beranda-command-bar .btn {
        min-width: 0 !important;
        padding-right: 9px !important;
        padding-left: 9px !important;
        font-size: 0.67rem !important;
    }

    body.beranda-app-page .premium-greeting-header {
        gap: 10px;
        padding: 18px !important;
    }

    body.beranda-app-page .greeting-avatar {
        width: 52px !important;
        height: 52px !important;
    }

    body.beranda-app-page .mobile-grid-launcher {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    }

    body.beranda-app-page #kioskMandiriModal .modal-footer {
        flex-direction: column-reverse;
    }

    body.beranda-app-page #kioskMandiriModal .modal-footer .btn {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    body.beranda-app-page :where(.carousel-chip, .mobile-grid-card, .classic-dashboard-card) {
        opacity: 1 !important;
        transform: none !important;
    }
}

/* ========================================================================
   MEMBER APP SHELL — shared polish for every page launched from Beranda App.
   Applied by ios-interaction.js only to authenticated non-admin pages.
   ======================================================================== */
body.sipesat-member-page {
    --member-shell-width: 1240px;
    --member-surface: rgba(255, 255, 255, 0.94);
    --member-surface-soft: rgba(248, 250, 255, 0.92);
    --member-line: rgba(31, 61, 110, 0.09);
    --member-text: #17233a;
    --member-muted: #687991;
    min-height: 100svh;
    min-height: 100dvh;
    overflow-x: clip !important;
    overflow-y: auto !important;
    color: var(--member-text) !important;
    background-color: #f3f6fb !important;
    background-image:
        radial-gradient(circle at 5% -8%, rgba(10, 122, 255, 0.11), transparent 29rem),
        radial-gradient(circle at 96% 20%, rgba(124, 58, 237, 0.075), transparent 26rem) !important;
    background-attachment: fixed !important;
}

body.sipesat-member-page.dark-mode {
    --member-surface: rgba(12, 29, 51, 0.94);
    --member-surface-soft: rgba(15, 36, 62, 0.9);
    --member-line: rgba(125, 183, 255, 0.12);
    --member-text: #f4f8ff;
    --member-muted: #a8bbd2;
    color: var(--member-text) !important;
    background-color: #07111f !important;
    background-image:
        radial-gradient(circle at 5% -8%, rgba(37, 99, 235, 0.31), transparent 32rem),
        radial-gradient(circle at 96% 20%, rgba(14, 165, 233, 0.12), transparent 27rem),
        radial-gradient(circle at 46% 112%, rgba(30, 64, 175, 0.16), transparent 38rem) !important;
}

body.sipesat-member-page :where(.container, .container-fluid, .row, [class*="col-"]) {
    min-width: 0;
}

body.sipesat-member-page > .container,
body.sipesat-member-page > .container-fluid > .container,
body.sipesat-member-page > .container-fluid > main,
body.sipesat-member-page .member-content-shell {
    width: min(var(--member-shell-width), calc(100% - 32px));
    max-width: var(--member-shell-width) !important;
    margin-right: auto !important;
    margin-left: auto !important;
}

/* Consistent native navigation header: fixes legacy -10px overflow too. */
body.sipesat-member-page .header-premium {
    width: min(1320px, calc(100% - 32px)) !important;
    max-width: 1320px !important;
    min-height: 76px;
    margin: 16px auto 18px !important;
    padding: 17px clamp(17px, 3vw, 28px) !important;
    overflow: hidden !important;
    color: var(--member-text) !important;
    background: color-mix(in srgb, var(--member-surface) 94%, transparent) !important;
    border: 1px solid var(--member-line) !important;
    border-radius: 24px !important;
    box-shadow: 0 20px 52px -36px rgba(28, 58, 111, 0.48) !important;
    backdrop-filter: blur(22px) saturate(150%);
    -webkit-backdrop-filter: blur(22px) saturate(150%);
    transition: box-shadow 180ms ease, transform 180ms ease, background-color 180ms ease !important;
}

body.sipesat-member-page .header-premium::before,
body.sipesat-member-page .header-premium::after {
    pointer-events: none;
}

body.sipesat-member-page .header-premium.is-page-scrolled {
    box-shadow: 0 22px 56px -32px rgba(28, 58, 111, 0.58) !important;
}

body.sipesat-member-page .header-premium :where(h1, h2, h3, h4, h5, h6) {
    color: var(--member-text) !important;
    letter-spacing: -0.035em;
}

body.sipesat-member-page .header-premium :where(p, span, small):not(.badge) {
    color: var(--member-muted) !important;
}

body.sipesat-member-page .header-premium :where(.btn-back, .header-action-btn, a[href]) {
    flex: 0 0 auto;
}

body.sipesat-member-page .header-premium .btn-back {
    width: 42px;
    height: 42px;
    min-width: 42px;
    margin-right: 12px !important;
    display: inline-grid;
    place-items: center;
    border: 1px solid var(--member-line);
    border-radius: 14px;
    background: var(--member-surface-soft);
    color: var(--ios-blue) !important;
    box-shadow: 0 10px 24px -18px rgba(10, 122, 255, 0.7);
}

body.sipesat-member-page.dark-mode .header-premium {
    background: linear-gradient(145deg, rgba(16, 38, 65, 0.96), rgba(8, 23, 42, 0.96)) !important;
    border-color: rgba(125, 183, 255, 0.13) !important;
    box-shadow: 0 26px 62px -36px rgba(0, 0, 0, 0.9), 0 0 34px rgba(37, 99, 235, 0.06) !important;
}

/* Surface family: consistent radius, spacing and legible dark mode. */
body.sipesat-member-page :where(
    .form-card,
    .history-card,
    .notif-card,
    .support-card,
    .feature-card,
    .stat-card,
    .quick-action-card,
    .filter-container,
    .verify-box,
    .service-picker,
    .repeater-card,
    .schema-field-card,
    .profile-card,
    .settings-card
) {
    max-width: 100%;
    color: var(--member-text);
    background-color: var(--member-surface) !important;
    border-color: var(--member-line) !important;
    border-radius: clamp(17px, 2vw, 23px) !important;
    box-shadow: 0 16px 42px -32px rgba(28, 58, 111, 0.5) !important;
}

body.sipesat-member-page.native-ui-ready :where(
    .history-card,
    .notif-card,
    .support-card,
    .feature-card,
    .stat-card,
    .quick-action-card
):hover {
    border-color: color-mix(in srgb, var(--ios-blue) 28%, var(--member-line)) !important;
    box-shadow: 0 22px 50px -32px rgba(28, 82, 176, 0.54) !important;
}

body.sipesat-member-page.dark-mode :where(
    .form-card,
    .history-card,
    .notif-card,
    .support-card,
    .feature-card,
    .stat-card,
    .quick-action-card,
    .filter-container,
    .verify-box,
    .service-picker,
    .repeater-card,
    .schema-field-card,
    .profile-card,
    .settings-card
) {
    color: #f4f8ff !important;
    background-color: var(--member-surface) !important;
    border-color: var(--member-line) !important;
    box-shadow: 0 20px 48px -34px rgba(0, 0, 0, 0.88) !important;
}

body.sipesat-member-page.dark-mode :where(
    .form-card,
    .history-card,
    .notif-card,
    .support-card,
    .feature-card,
    .stat-card,
    .quick-action-card,
    .filter-container,
    .verify-box,
    .repeater-card,
    .schema-field-card
) :where(h1, h2, h3, h4, h5, h6, strong, label, .text-dark) {
    color: #f5f9ff !important;
}

body.sipesat-member-page.dark-mode :where(
    .form-card,
    .history-card,
    .notif-card,
    .support-card,
    .feature-card,
    .stat-card,
    .quick-action-card,
    .filter-container,
    .verify-box,
    .repeater-card,
    .schema-field-card
) :where(p, small, .small, .text-muted, .text-secondary) {
    color: #a9bad0 !important;
}

body.sipesat-member-page.dark-mode :where(.bg-white, .bg-light):not(.badge):not(.btn) {
    background-color: rgba(15, 36, 62, 0.88) !important;
}

/* Form controls use comfortable touch size without making actions gigantic. */
body.sipesat-member-page :where(.form-control, .form-select, textarea, input:not([type="checkbox"]):not([type="radio"]), select) {
    max-width: 100%;
    min-height: 44px;
    border-radius: 13px !important;
}

body.sipesat-member-page textarea.form-control,
body.sipesat-member-page textarea {
    min-height: 88px;
}

body.sipesat-member-page :where(.btn, button, [role="button"]) {
    max-width: 100%;
    overflow-wrap: anywhere;
}

body.sipesat-member-page .btn:not(.btn-sm):not(.btn-xs):not(.btn-close):not(.btn-delete-row) {
    min-height: 42px;
    border-radius: 13px !important;
}

body.sipesat-member-page :where(.btn-group, .modal-footer, .card-footer, .action-row) {
    min-width: 0;
}

body.sipesat-member-page :where(.table-responsive, .dataTables_wrapper) {
    border-radius: 17px;
    scrollbar-width: thin;
    overscroll-behavior-x: contain;
}

body.sipesat-member-page :where(img, video, canvas, iframe, svg) {
    max-width: 100%;
}

body.sipesat-member-page :where(.history-card, .notif-card) {
    content-visibility: auto;
    contain-intrinsic-size: auto 180px;
}

/* Native modal/bottom-sheet behavior on phones. */
@media (max-width: 767.98px) {
    body.sipesat-member-page {
        --member-shell-width: 100%;
        padding-bottom: calc(88px + env(safe-area-inset-bottom)) !important;
    }

    body.sipesat-member-page > .container,
    body.sipesat-member-page > .container-fluid > .container,
    body.sipesat-member-page > .container-fluid > main,
    body.sipesat-member-page .member-content-shell {
        width: 100%;
        padding-right: 12px !important;
        padding-left: 12px !important;
    }

    body.sipesat-member-page .header-premium {
        width: calc(100% - 20px) !important;
        min-height: 68px;
        margin: 10px auto 14px !important;
        padding: 14px 13px !important;
        border-radius: 21px !important;
    }

    body.sipesat-member-page .header-premium h4 {
        max-width: min(66vw, 420px);
        font-size: clamp(1rem, 5vw, 1.22rem) !important;
        line-height: 1.2;
    }

    body.sipesat-member-page .header-premium :where(p, span, small):not(.badge) {
        font-size: clamp(0.66rem, 3vw, 0.76rem) !important;
    }

    body.sipesat-member-page .header-premium .btn-back {
        width: 40px;
        height: 40px;
        min-width: 40px;
        margin-right: 10px !important;
        border-radius: 13px;
        font-size: 1.25rem !important;
    }

    body.sipesat-member-page :where(.form-card, .history-card, .notif-card, .support-card, .feature-card, .filter-container) {
        padding: 15px !important;
        border-radius: 19px !important;
    }

    body.sipesat-member-page :where(.row.g-4, .row.g-5) {
        --bs-gutter-y: 0.85rem;
    }

    body.sipesat-member-page .modal-dialog:not(.modal-fullscreen) {
        width: calc(100% - 16px) !important;
        max-width: calc(100% - 16px) !important;
        margin: 8px auto !important;
    }

    body.sipesat-member-page .modal-dialog-centered {
        min-height: calc(100% - 16px) !important;
    }

    body.sipesat-member-page .modal-content {
        max-height: calc(100dvh - 16px);
        overflow: hidden;
        border-radius: 24px !important;
    }

    body.sipesat-member-page .modal-body {
        overflow-x: hidden;
        overflow-y: auto;
        overscroll-behavior: contain;
    }

    body.sipesat-member-page .modal-footer {
        gap: 8px;
        padding: 11px 13px calc(11px + env(safe-area-inset-bottom));
    }

    body.sipesat-member-page .modal-footer > .btn {
        min-width: 0;
        flex: 1 1 130px;
        margin: 0 !important;
    }

    body.sipesat-member-page :where(.filter-container, .history-card, .notif-card, .swipe-container) {
        width: 100% !important;
        max-width: 100% !important;
        margin-right: 0 !important;
        margin-left: 0 !important;
    }

    body.sipesat-member-page :where(.table-responsive, .dataTables_wrapper) {
        margin-right: 0 !important;
        margin-left: 0 !important;
    }
}

@media (max-width: 379.98px) {
    body.sipesat-member-page .header-premium {
        width: calc(100% - 16px) !important;
        padding: 12px 11px !important;
    }

    body.sipesat-member-page .header-premium h4 {
        max-width: 61vw;
    }

    body.sipesat-member-page :where(.form-card, .history-card, .notif-card, .support-card, .feature-card, .filter-container) {
        padding: 13px !important;
    }
}

/* Desktop is a real workspace, not a stretched phone canvas. */
@media (min-width: 768px) {
    body.sipesat-member-page {
        padding-bottom: 54px !important;
    }

    body.sipesat-member-page .header-premium {
        margin-top: 24px !important;
    }

    body.sipesat-member-page > .container,
    body.sipesat-member-page > .container-fluid > .container {
        width: min(var(--member-shell-width), calc(100% - 48px));
        max-width: var(--member-shell-width) !important;
    }

    body.sipesat-member-page :where(.form-card, .filter-container) {
        padding: clamp(24px, 3vw, 36px) !important;
    }

    body.sipesat-member-page .form-card {
        box-shadow: 0 28px 74px -48px rgba(28, 58, 111, 0.58) !important;
    }

    body.sipesat-member-page :where(.history-card, .notif-card, .support-card, .feature-card, .quick-action-card) {
        transform: translateZ(0);
    }
}

@media (prefers-reduced-motion: reduce) {
    body.sipesat-member-page *,
    body.sipesat-member-page *::before,
    body.sipesat-member-page *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
