/*
 * Confirm Loan — mobile app shell for the public website.
 * Loaded after app.css. These rules are not inside a cascade layer, so they win over
 * Tailwind's layered utilities without !important. Everything visual is limited to
 * phones (< 768px); tablets and desktop keep the original website layout.
 */

/* ---------- visibility helpers (!important so component display rules never override them) ---------- */
.ma-tabbar, .ma-appbar, .ma-only, .ma-xs-only { display: none !important; }

@media (max-width: 767.98px) {
    .ma-only { display: revert !important; }
    .ma-appbar, .ma-tabbar { display: block !important; }
    .ma-desk-only, .ma-site .ma-hide { display: none !important; }
}
@media (max-width: 639.98px) {
    .ma-xs-only { display: inline-flex !important; }
}

/* ---------- small pills used in the headers and sheet ---------- */
.ma-pill {
    display: inline-flex; align-items: center; justify-content: center;
    min-height: 2.25rem; padding: 0 1rem; border-radius: 999px;
    background: var(--cl-primary); color: #fff;
    font-size: .8125rem; font-weight: 600; line-height: 1; white-space: nowrap;
    box-shadow: 0 6px 14px -6px rgba(21, 94, 239, .55);
}
.ma-pill--glass {
    background: rgba(255, 255, 255, .16); color: #fff; box-shadow: none;
    border: 1px solid rgba(255, 255, 255, .28);
    -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}

/* ======================================================================
   PHONES
   ====================================================================== */
@media (max-width: 767.98px) {

    /* room for the floating tab bar (the navy footer runs underneath it) */
    .ma-site { scroll-padding-bottom: 6rem; }
    .ma-appbar { --cl-header-h: 3.5rem; }

    /* ---------- section rhythm: app spacing instead of website spacing ---------- */
    .ma-sec > div { padding-top: 1.75rem; padding-bottom: 1.75rem; }
    .ma-sec--uses > div { padding-top: 1.75rem; padding-bottom: .5rem; }
    .ma-sec > div.grid { row-gap: 1rem; }
    .ma-sec h2.ma-h2 + p { margin-top: .375rem; font-size: .875rem; line-height: 1.5; }
    .ma-sec [class*="mt-12"], .ma-sec [class*="mt-14"] { margin-top: 1rem; }

    .ma-h2 {
        font-size: 1.3125rem; line-height: 1.25; letter-spacing: -.015em;
        max-width: none;
    }
    .ma-lead { margin-top: .375rem; font-size: .875rem; line-height: 1.5; }
    .ma-eyebrow { font-size: .6875rem; }
    .ma-fine { margin-top: .75rem; font-size: .6875rem; line-height: 1.5; }

    /* header row with a "Details" link on the right, like an app section header */
    .ma-head { flex-direction: row; align-items: flex-end; justify-content: space-between; gap: .75rem; }
    .ma-head > a { flex-shrink: 0; min-height: 2rem; font-size: .8125rem; }

    /* ---------- loan purposes carousel ---------- */
    .ma-uses { margin-top: 1rem; grid-auto-columns: 58%; }
    .ma-uses > a > :first-child { aspect-ratio: 4 / 4.5; }
    .ma-uses > a > div:last-child { padding: .875rem; }
    .ma-uses h3 { font-size: .9375rem; }
    .ma-uses-copy { font-size: .75rem; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
    .ma-uses .glass { width: 2.25rem; height: 2.25rem; margin-bottom: .5rem; }

    /* ---------- feature tiles: 2 x 2 ---------- */
    .ma-features { grid-template-columns: 1fr 1fr; gap: .625rem; margin-top: 1rem; }
    .ma-feature { padding: .875rem; border-radius: 1.125rem; box-shadow: none; }
    .ma-feature > span:first-child { width: 2.5rem; height: 2.5rem; border-radius: .75rem; }
    .ma-feature > span:first-child svg { width: 1.25rem; height: 1.25rem; }
    .ma-feature-h { margin-top: .75rem; font-size: .875rem; line-height: 1.3; }
    .ma-feature p { margin-top: .25rem; font-size: .75rem; line-height: 1.45; }

    /* ---------- stats strip: 4 in a row ---------- */
    .ma-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: .75rem; border-radius: 1.125rem; }
    .ma-stats > div { padding: .875rem .25rem; text-align: center; }
    .ma-stats dd { font-size: 1.25rem; }
    .ma-stats p { margin-top: .375rem; font-size: .6875rem; line-height: 1.25; }

    /* ---------- how it works: swipeable screen cards ---------- */
    .ma-steps {
        display: flex; gap: .75rem; margin: 1rem -1rem 0; padding: 0 1rem .25rem;
        overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding: 0 1rem;
        scrollbar-width: none; -webkit-overflow-scrolling: touch;
    }
    .ma-steps::-webkit-scrollbar { display: none; }
    .ma-step { flex: 0 0 78%; scroll-snap-align: start; border-radius: 1.25rem; }
    .ma-step-body { padding: 1rem 1rem .75rem; }
    .ma-step-body h3 { margin-top: .25rem; font-size: 1rem; }
    .ma-step-body p { font-size: .8125rem; line-height: 1.45; }
    .ma-step-img { height: 12.5rem; padding: 1rem 1.75rem 0; }

    /* ---------- EMI calculator ---------- */
    .ma-emi-card { padding: 1rem; border-radius: 1.25rem; box-shadow: 0 10px 30px -18px rgba(11, 31, 58, .35); }
    .ma-emi-card .space-y-6 > :not(:last-child) { margin-bottom: 1rem; }
    .ma-emi-card [data-out="emi"] { font-size: 2rem; }
    .ma-emi-card > .mt-7 { margin-top: 1rem; padding: 1rem; }
    .ma-emi-card > .mt-5 { margin-top: 1rem; }
    .ma-emi-card > .mt-5 a { width: 100%; }

    /* ---------- grouped rows (list-in-a-card) ---------- */
    .ma-rows {
        display: block; margin-top: 1rem; padding: 0 1rem;
        background: #fff; border: 1px solid var(--cl-border); border-radius: 1.25rem;
    }
    .ma-rows > * { display: flex; gap: .875rem; margin: 0; padding: .875rem 0; border: 0; border-radius: 0; box-shadow: none; }
    .ma-rows > * + * { border-top: 1px solid var(--cl-border); }
    .ma-rows > * > span:first-child { width: 2.5rem; height: 2.5rem; flex-shrink: 0; border-radius: .75rem; }
    .ma-rows h3 { margin-top: 0; font-size: .9375rem; }
    .ma-rows p { margin-top: .125rem; font-size: .8125rem; line-height: 1.45; }
    .ma-rows--cards > * {
        display: grid; grid-template-columns: 2.5rem minmax(0, 1fr); column-gap: .875rem; row-gap: 0;
        align-items: start; padding: .875rem 0;
    }
    .ma-rows--cards > * > span:first-child { grid-row: span 2; }
    .ma-rows--cards > * > h3, .ma-rows--cards > * > p { grid-column: 2; }
    .ma-rows--cards > *:hover { box-shadow: none; }

    /* support contacts as tappable action rows */
    .ma-contact {
        margin-top: 1rem; padding: .25rem 1rem; background: var(--cl-surface-alt);
        border-radius: 1.125rem;
    }
    .ma-contact > * + * { margin-top: 0; border-top: 1px solid var(--cl-border); }
    .ma-contact > * { min-height: 3rem; font-size: .875rem; }
    .ma-contact > p { padding: .75rem 0; font-size: .8125rem; align-items: flex-start; }

    /* ---------- dark tracking section ---------- */
    .ma-sec--track > div { padding-bottom: 2rem; }
    .ma-milestones { margin-top: 1.25rem; }
    .ma-milestones ol { gap: 1rem; }
    .ma-milestones h3 { font-size: .9375rem; }
    .ma-milestones p { margin-top: .25rem; font-size: .8125rem; }

    /* ---------- FAQ ---------- */
    .ma-faq-actions { margin-top: .875rem; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: .5rem; }
    .ma-faq-actions > * { min-height: 2.75rem; font-size: .875rem; }

    /* ---------- closing CTA ---------- */
    .ma-cta > div { padding-top: 1.25rem; padding-bottom: 1.5rem; }
    .ma-cta > div > div { padding: 1.5rem 1.25rem; border-radius: 1.5rem; }
    .ma-cta-h { font-size: 1.3125rem; }
    .ma-cta-p { margin-top: .5rem; font-size: .875rem; }
    .ma-cta-btns { margin-top: 1.25rem; display: grid; grid-template-columns: 1fr 1fr; gap: .625rem; }
    .ma-cta-btns > a { min-height: 3rem; padding: 0 .75rem; font-size: .9375rem; }
    .ma-cta > div > p { font-size: .6875rem; }

    /* ---------- inner page hero: compact brand card ---------- */
    .ma-phero { border: 0; background: #fff; }
    .ma-phero > div {
        position: relative; overflow: hidden; isolation: isolate;
        margin: .875rem 1rem 0; padding: 1.25rem 1.125rem 1.375rem; border-radius: 1.5rem;
        background: linear-gradient(140deg, #2b6ef5 0%, #155eef 38%, #0b2e73 100%);
        color: #fff; box-shadow: 0 16px 32px -20px rgba(21, 94, 239, .7);
    }
    .ma-phero > div::after {
        content: ""; position: absolute; z-index: -1; right: -3.5rem; top: -3.5rem;
        width: 11rem; height: 11rem; border-radius: 50%;
        border: 1px solid rgba(255, 255, 255, .14); box-shadow: 0 0 0 1.75rem rgba(255, 255, 255, .04);
    }
    .ma-phero-h { font-size: 1.375rem; line-height: 1.25; letter-spacing: -.015em; color: #fff; }
    .ma-phero-p { margin-top: .5rem; font-size: .875rem; line-height: 1.5; color: rgba(255, 255, 255, .82); }
    .ma-phero > div > p:not(.ma-phero-p) { margin-top: .75rem; color: rgba(255, 255, 255, .7); font-size: .75rem; }
    .ma-phero > div > *:not(h1):not(p) { color: inherit; }
    .ma-phero + * > div, .ma-phero + section > div { padding-top: 1.25rem; }



    /* ---------- how it works page ---------- */
    .ma-hsteps > :not(:last-child) { margin-bottom: 1rem; }
    .ma-hstep {
        gap: 0; overflow: hidden; border: 1px solid var(--cl-border); border-radius: 1.25rem; background: #fff;
    }
    .ma-hstep > div:first-child { padding: 1rem 1rem .875rem; }
    .ma-hstep-h { margin-top: .25rem; font-size: 1.125rem; }
    .ma-hstep > div:first-child > p { margin-top: .25rem; font-size: .875rem; }
    .ma-hstep ul { margin-top: .75rem; }
    .ma-hstep ul > :not(:last-child) { margin-bottom: .5rem; }
    .ma-hstep li { font-size: .8125rem; line-height: 1.45; }
    .ma-hstep-img { height: 13.5rem; padding: 1rem 1rem 0; border-radius: 0; }
    .ma-hstep-img figure { width: 11.5rem; }

    .ma-need { gap: .625rem; }
    .ma-need > li { padding: .875rem; gap: .75rem; }
    .ma-need h3 { font-size: .9375rem; }
    .ma-need p { font-size: .8125rem; margin-top: .125rem; }

    .ma-stages { grid-template-columns: 1fr 1fr; margin-top: 1rem; border-radius: 1.125rem; }
    .ma-stages > li { padding: .75rem .875rem; }
    .ma-stages h3 { margin-top: .125rem; font-size: .875rem; }
    .ma-stages p { font-size: .75rem; line-height: 1.4; }
    .ma-mbox { margin-top: 1.25rem; padding: 1rem; }
    .ma-mbox h2 { font-size: 1.0625rem; }
    .ma-mbox p { font-size: .8125rem; }
    .ma-mbox ol { margin-top: 1rem; gap: 1rem; }
    .ma-mbox ol h3 { font-size: .9375rem; }

    /* ---------- about page ---------- */
    .ma-about-cards { gap: .75rem; margin-top: 1rem; }
    .ma-about-cards > div { padding: 1rem; border-radius: 1.25rem; }
    .ma-about-cards h3 { font-size: 1rem; }
    .ma-about-cards ul { margin-top: .75rem; }
    .ma-about-cards ul > :not(:last-child) { margin-bottom: .625rem; }
    .ma-about-cards li { font-size: .8125rem; line-height: 1.45; }
    .ma-principles {
        grid-template-columns: 1fr 1fr; gap: .625rem; margin-top: 1rem;
    }
    .ma-principles > div {
        padding: .875rem; border: 1px solid var(--cl-border); border-radius: 1.125rem; background: #fff;
    }
    .ma-principles h3 { margin-top: .5rem; font-size: .875rem; }
    .ma-principles p { margin-top: .25rem; font-size: .75rem; line-height: 1.45; }
    .ma-sec .space-y-4 > :not(:last-child) { margin-bottom: .75rem; }
    .ma-sec .mt-4.space-y-4 { margin-top: .5rem; font-size: .875rem; }

    /* ---------- contact page ---------- */
    .ma-contact-sec > div { padding-top: 1rem; gap: 1.25rem; }
    .ma-contact-sec .space-y-4 > :not(:last-child) { margin-bottom: .625rem; }

    /* ---------- legal pages ---------- */
    .ma-legal { gap: 1rem; padding-top: 1rem; padding-bottom: 1.75rem; }
    .ma-legal article { font-size: .9375rem; }

    /* ---------- error pages ---------- */
    .ma-err > div { padding-top: 2rem; padding-bottom: 2.5rem; }

    /* ---------- footer: compact ---------- */
    .ma-footer > div { padding-top: 1.75rem; padding-bottom: calc(6.5rem + env(safe-area-inset-bottom)); }
    .ma-footer-grid { grid-template-columns: 1fr 1fr; column-gap: 1rem; row-gap: 1.25rem; }
    .ma-footer-brand, .ma-footer-grid > div:last-child { grid-column: 1 / -1; }
    .ma-footer-brand p { margin-top: .75rem; font-size: .8125rem; }
    .ma-footer-grid ul { margin-top: .375rem; }
    .ma-footer-grid ul a { min-height: 2.25rem; font-size: .875rem; }
    .ma-footer-fine { margin-top: 1.5rem; font-size: .6875rem; }
    .ma-footer > div > div:last-child { margin-top: 1rem; padding-top: 1rem; font-size: .75rem; }

    /* ---------- sheet ---------- */
    .ma-sheet { position: fixed; inset: 0; z-index: 70; }
    .ma-sheet[hidden] { display: none; }
    .ma-sheet__backdrop {
        position: absolute; inset: 0; background: rgba(11, 31, 58, .45);
        opacity: 0; transition: opacity .28s var(--cl-ease);
    }
    .ma-sheet__panel {
        position: absolute; left: 0; right: 0; bottom: 0;
        max-height: calc(100dvh - 2.5rem - env(safe-area-inset-top)); overflow-y: auto; overscroll-behavior: contain;
        background: #fff; border-radius: 1.75rem 1.75rem 0 0;
        padding: .625rem 1rem calc(1.25rem + env(safe-area-inset-bottom));
        transform: translateY(100%); transition: transform .34s var(--cl-ease);
        box-shadow: 0 -20px 40px -20px rgba(11, 31, 58, .35); outline: none;
    }
    .ma-sheet.is-open .ma-sheet__backdrop { opacity: 1; }
    .ma-sheet.is-open .ma-sheet__panel { transform: none; }
    .ma-sheet__grab { width: 2.5rem; height: .3125rem; margin: 0 auto .5rem; border-radius: 99px; background: #cbd5e1; }
    .ma-sheet__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: .5rem; }
    .ma-sheet__title { font-size: 1.0625rem; font-weight: 600; color: var(--cl-navy); }
    .ma-sheet__x {
        display: flex; align-items: center; justify-content: center; width: 2.25rem; height: 2.25rem;
        border-radius: 50%; background: var(--cl-surface-alt); color: var(--cl-navy);
    }
    .ma-sheet__label {
        margin: 1.125rem .25rem .5rem; font-size: .6875rem; font-weight: 600;
        letter-spacing: .07em; text-transform: uppercase; color: var(--cl-text-muted);
    }
    .ma-sheet__fine { margin: 1.25rem .25rem 0; font-size: .6875rem; line-height: 1.5; color: var(--cl-text-muted); }

    .ma-acc { display: flex; align-items: center; gap: .75rem; padding: .875rem; border-radius: 1.25rem; background: var(--cl-surface-alt); }
    .ma-acc__av {
        display: flex; align-items: center; justify-content: center; flex-shrink: 0;
        width: 2.75rem; height: 2.75rem; border-radius: 50%;
        background: linear-gradient(180deg, #3b7bff, var(--cl-primary)); color: #fff; font-size: .875rem; font-weight: 600;
    }
    .ma-acc__name { font-size: .9375rem; font-weight: 600; color: var(--cl-navy); }
    .ma-acc__sub { margin-top: .0625rem; font-size: .75rem; color: var(--cl-text-muted); }
    .ma-create {
        display: flex; align-items: center; justify-content: center; gap: .375rem; min-height: 2.75rem;
        margin-top: .5rem; border-radius: 1rem; border: 1px dashed #c7d6f5; font-size: .8125rem; color: var(--cl-text-muted);
    }
    .ma-create strong { color: var(--cl-primary); font-weight: 600; }
    .ma-create svg { color: var(--cl-primary); }

    .ma-list { border: 1px solid var(--cl-border); border-radius: 1.25rem; overflow: hidden; }
    .ma-list li + li { border-top: 1px solid var(--cl-border); }
    .ma-list__row {
        display: flex; align-items: center; gap: .75rem; min-height: 3.25rem; padding: 0 .875rem;
        font-size: .9375rem; font-weight: 500; color: var(--cl-navy);
    }
    .ma-list__row:active { background: var(--cl-surface-alt); }
    .ma-list__ic {
        display: flex; align-items: center; justify-content: center; flex-shrink: 0;
        width: 2.125rem; height: 2.125rem; border-radius: .625rem; background: #e8f0fe; color: var(--cl-primary);
    }
    .ma-logout {
        display: flex; width: 100%; align-items: center; justify-content: center; gap: .5rem; min-height: 3rem;
        border-radius: 1rem; background: #fef2f2; color: var(--cl-error); font-size: .9375rem; font-weight: 600;
    }

    /* "More" tab looks active while the sheet is open */
    .ma-more-btn[aria-expanded="true"] { color: var(--cl-primary); }
    .ma-more-btn[aria-expanded="true"] .ma-more-pill { background: rgba(21, 94, 239, .1); }

    html.ma-lock, html.ma-lock body { overflow: hidden; }
}

@media (prefers-reduced-motion: reduce) {
    .ma-sheet__panel, .ma-sheet__backdrop { transition: none; }
}

/* a lone hero button (signed-in visitors) spans the full row */
.ma-span2 { grid-column: 1 / -1; }
