/* ══════════════════════════════════════════════════════════════
   mobile-app.css — phone par portal ko Android app jaisa banata hai.
   Reference: Alpha Flutter app (emulator, 23-Sep-2026) — dark navy canvas,
   glass cards, teal accent, neeche floating nav with raised centre button.

   Sirf phone par lagta hai (<= 820px). Desktop ko ye file chhoo bhi nahi
   sakti — har rule media query ke andar hai.
   ══════════════════════════════════════════════════════════════ */

:root {
    --m-canvas: #070B14;
    --m-glass: rgba(255, 255, 255, .06);
    --m-glass-2: rgba(255, 255, 255, .10);
    --m-stroke: rgba(255, 255, 255, .10);
    --m-teal: #1ABC9C;
    --m-teal-soft: rgba(26, 188, 156, .16);
    --m-green: #22c55e;
    --m-red: #ef4444;
    --m-text: #E7EDF5;
    --m-muted: #7C8AA0;
    --m-nav-h: 74px;
}

@media (max-width: 820px) {

    /* ── Desktop chrome hatao ─────────────────────────────── */
    body.mapp .sidebar,
    body.mapp .sidebar-overlay,
    body.mapp #sidebarToggle,
    body.mapp .navbar-toggler {
        display: none !important;
    }

    body.mapp {
        background: var(--m-canvas) !important;
        color: var(--m-text);
        -webkit-font-smoothing: antialiased;
        overscroll-behavior-y: contain;
    }

    body.mapp .main-content {
        margin-left: 0 !important;
        padding: 0 !important;
        padding-bottom: calc(var(--m-nav-h) + env(safe-area-inset-bottom) + 10px) !important;
    }

    /* ── Bottom nav (mobile-shell.js inject karta hai) ────── */
    .m-nav {
        position: fixed;
        left: 10px;
        right: 10px;
        bottom: calc(8px + env(safe-area-inset-bottom));
        z-index: 4000;
        display: flex;
        align-items: flex-end;
        justify-content: space-around;
        padding: 9px 10px 10px;
        border-radius: 22px;
        background: rgba(18, 26, 40, .82);
        backdrop-filter: blur(18px);
        -webkit-backdrop-filter: blur(18px);
        border: 1px solid var(--m-stroke);
        box-shadow: 0 10px 30px rgba(0, 0, 0, .45);
    }

    .m-nav a {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 3px;
        font-size: 10px;
        color: var(--m-muted);
        text-decoration: none;
        padding: 2px 0;
    }

    .m-nav a i {
        font-size: 17px;
    }

    .m-nav a.on {
        color: var(--m-teal);
    }

    .m-nav a.on::after {
        content: '';
        width: 16px;
        height: 2px;
        border-radius: 2px;
        background: var(--m-teal);
    }

    .m-nav a.m-center {
        flex: 0 0 auto;
    }

    .m-nav a.m-center span {
        width: 52px;
        height: 52px;
        margin-top: -24px;
        border-radius: 50%;
        background: linear-gradient(180deg, #2ee6bf, #12a184);
        color: #05221b;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 20px;
        border: 3px solid var(--m-canvas);
        box-shadow: 0 10px 26px rgba(26, 188, 156, .45);
    }

    /* ── Page header ──────────────────────────────────────── */
    .m-head {
        display: flex;
        align-items: center;
        gap: 11px;
        padding: calc(14px + env(safe-area-inset-top)) 14px 10px;
        background: linear-gradient(180deg, rgba(26, 188, 156, .10), transparent);
    }

    .m-avatar {
        width: 40px;
        height: 40px;
        border-radius: 50%;
        background: linear-gradient(180deg, #2ee6bf, #12a184);
        color: #05221b;
        font-weight: 800;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 16px;
    }

    .m-hello {
        font-size: 11px;
        color: var(--m-muted);
    }

    .m-name {
        font-weight: 700;
        font-size: 16px;
        line-height: 1.2;
    }

    .m-ico {
        width: 36px;
        height: 36px;
        border-radius: 12px;
        background: var(--m-glass);
        border: 1px solid var(--m-stroke);
        display: flex;
        align-items: center;
        justify-content: center;
        color: #cfd8e4;
        font-size: 14px;
        text-decoration: none;
    }

    .m-wrap {
        padding: 0 14px;
    }

    /* ── Cards / sections ─────────────────────────────────── */
    .m-card {
        border-radius: 18px;
        padding: 14px;
        background: var(--m-glass);
        border: 1px solid var(--m-stroke);
    }

    .m-hero {
        border-radius: 20px;
        padding: 16px;
        background: linear-gradient(145deg, rgba(26, 188, 156, .20), rgba(26, 188, 156, .05));
        border: 1px solid rgba(26, 188, 156, .30);
        box-shadow: 0 12px 30px rgba(26, 188, 156, .12);
    }

    .m-hero-top {
        display: flex;
        align-items: center;
        gap: 8px;
    }

    .m-lab {
        font-size: 10px;
        letter-spacing: .6px;
        color: #9fe6d4;
        font-weight: 700;
    }

    .m-pill {
        margin-left: auto;
        font-size: 11px;
        font-weight: 700;
        padding: 5px 10px;
        border-radius: 999px;
        background: rgba(37, 99, 235, .22);
        border: 1px solid rgba(96, 165, 250, .35);
        color: #bfdbfe;
        display: flex;
        align-items: center;
        gap: 5px;
    }

    .m-live {
        font-size: 10px;
        color: var(--m-green);
        display: flex;
        align-items: center;
        gap: 4px;
    }

    .m-live::before {
        content: '';
        width: 6px;
        height: 6px;
        border-radius: 50%;
        background: var(--m-green);
        box-shadow: 0 0 8px var(--m-green);
    }

    .m-big {
        font-size: 30px;
        font-weight: 800;
        margin-top: 6px;
        font-variant-numeric: tabular-nums;
        line-height: 1.1;
    }

    .m-sub {
        font-size: 12px;
        color: #bfe9dd;
        margin-top: 2px;
        font-variant-numeric: tabular-nums;
    }

    .m-tiles {
        display: flex;
        gap: 8px;
        margin-top: 12px;
    }

    .m-tile {
        flex: 1;
        border-radius: 13px;
        padding: 9px 10px;
        background: rgba(255, 255, 255, .06);
        border: 1px solid var(--m-stroke);
    }

    .m-tile .l {
        font-size: 9px;
        letter-spacing: .4px;
        color: var(--m-muted);
        text-transform: uppercase;
    }

    .m-tile .v {
        font-size: 14px;
        font-weight: 700;
        margin-top: 3px;
        font-variant-numeric: tabular-nums;
    }

    .m-sec {
        display: flex;
        align-items: center;
        margin: 18px 2px 9px;
    }

    .m-sec h3 {
        margin: 0;
        font-size: 14px;
        font-weight: 700;
    }

    .m-sec .more {
        margin-left: auto;
        font-size: 11px;
        color: var(--m-muted);
        text-decoration: none;
    }

    /* Quick access */
    .m-quick {
        display: flex;
        gap: 9px;
        overflow-x: auto;
        padding-bottom: 4px;
        scrollbar-width: none;
    }

    .m-quick::-webkit-scrollbar {
        display: none;
    }

    .m-quick a {
        flex: 0 0 auto;
        width: 70px;
        border-radius: 15px;
        padding: 11px 6px;
        text-align: center;
        background: var(--m-glass);
        border: 1px solid var(--m-stroke);
        color: #cfd8e4;
        font-size: 10px;
        text-decoration: none;
    }

    .m-quick a i {
        display: block;
        font-size: 17px;
        margin-bottom: 6px;
        color: var(--m-teal);
    }

    /* Position / order rows */
    .m-row {
        display: flex;
        align-items: center;
        gap: 10px;
        border-radius: 15px;
        padding: 11px 12px;
        background: var(--m-glass);
        border: 1px solid var(--m-stroke);
        margin-bottom: 8px;
    }

    .m-row .s {
        font-weight: 700;
        font-size: 14px;
    }

    .m-row .e {
        font-size: 10px;
        color: var(--m-muted);
        margin-top: 2px;
    }

    .m-row .r {
        margin-left: auto;
        text-align: right;
        font-variant-numeric: tabular-nums;
    }

    .m-row .r b {
        font-size: 14px;
    }

    .m-row .r span {
        display: block;
        font-size: 10px;
        color: var(--m-muted);
        margin-top: 2px;
    }

    .m-badge {
        font-size: 9px;
        font-weight: 800;
        padding: 4px 7px;
        border-radius: 7px;
        letter-spacing: .3px;
    }

    .m-badge.long {
        background: rgba(34, 197, 94, .16);
        color: #6ee7b7;
    }

    .m-badge.short {
        background: rgba(239, 68, 68, .16);
        color: #fca5a5;
    }

    .m-badge.filled {
        background: rgba(34, 197, 94, .14);
        color: #6ee7b7;
    }

    .m-badge.pending {
        background: rgba(234, 179, 8, .16);
        color: #fde68a;
    }

    .m-badge.cancelled {
        background: rgba(148, 163, 184, .14);
        color: #cbd5e1;
    }

    .m-empty {
        border-radius: 16px;
        padding: 26px 14px;
        text-align: center;
        color: var(--m-muted);
        font-size: 12px;
        background: rgba(255, 255, 255, .03);
        border: 1px dashed var(--m-stroke);
    }

    .m-empty i {
        display: block;
        font-size: 22px;
        margin-bottom: 8px;
        opacity: .5;
    }

    .m-green {
        color: var(--m-green);
    }

    .m-red {
        color: var(--m-red);
    }

    /* ── Chart page — phone layout ─────────────────────────
       Upar patla bar (sirf symbol, bhav, settings), neeche trade panel ek
       sheet ki tarah: band rehta hai (poora chart dikhe) aur handle dabane
       par upar aata hai. Sheet ka khulna/band hona mobile-shell.js sambhalta
       hai (purana code 240px ka desktop panel kholta tha). */
    /* Chart page: na page bounce, na text select — ungli sirf chart aur
       SL/TP ke liye. Input/textarea me select chalu rehta hai. */
    body.mapp.mchart,
    body.mapp.mchart #chartV2Page {
        overscroll-behavior: none;
        -webkit-user-select: none;
        user-select: none;
        -webkit-touch-callout: none;
    }

    body.mapp.mchart input,
    body.mapp.mchart textarea {
        -webkit-user-select: text;
        user-select: text;
    }

    /* Chart page par bhi neeche nav rehta hai — warna guest (aur logged-in
       user bhi) chart me phas jaata hai: phone par sidebar chhupa hua hai,
       to dashboard/login tak jaane ka koi raasta hi nahi bachta.
       Page ki height se nav ki jagah kaat dete hain, taaki nav chart ke
       neeche wale time-axis aur trade-sheet handle ko na dhake. */
    body.mapp.mchart #chartV2Page {
        box-sizing: border-box;
        padding-bottom: calc(var(--m-nav-h) + env(safe-area-inset-bottom)) !important;
    }

    /* Chart par nav thoda patla — har pixel chart ka hai */
    body.mapp.mchart .m-nav {
        padding: 7px 10px 8px;
    }

    body.mapp.mchart .m-nav a.m-center span {
        width: 46px;
        height: 46px;
        margin-top: -20px;
        font-size: 18px;
    }

    body.mapp #chartV2TopBar {
        height: 46px !important;
        padding: 0 8px !important;
        gap: 6px !important;
        overflow-x: auto;
        overflow-y: hidden;
        flex-wrap: nowrap !important;
        scrollbar-width: none;
    }

    body.mapp #chartV2TopBar::-webkit-scrollbar {
        display: none;
    }

    /* Phone par jagah kam hai — ye sab settings/menu me se mil jaate hain */
    body.mapp #tzClockV2,
    body.mapp #themeBtnV2,
    body.mapp #resetDefaultsBtnV2,
    body.mapp #annBtnV2,
    body.mapp #signalStatusV2 {
        display: none !important;
    }

    body.mapp #chartV2LivePrice {
        font-size: 15px !important;
    }

    body.mapp #chartV2PriceChange {
        font-size: 11px !important;
    }

    body.mapp #brokerStatusV2 {
        max-width: 78px;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    body.mapp .cv2-divider {
        margin: 0 4px !important;
    }

    /* Trade panel = bottom sheet */
    body.mapp #cbToggleStripV2 {
        height: 26px !important;
        border-radius: 16px 16px 0 0;
    }

    /* App me trade sheet chart ke UPAR aati hai — chart peeche poora hi
       rehta hai. Pehle ye flex flow me thi, to khulte hi chart sikud kar
       ek patti bhar reh jaata tha (asli phone par saaf dikha). */
    body.mapp #chartBottomV2 {
        flex-direction: column !important;
        position: fixed !important;
        left: 0;
        right: 0;
        bottom: calc(var(--m-nav-h) + env(safe-area-inset-bottom));
        z-index: 3500;
        border-radius: 18px 18px 0 0;
        box-shadow: 0 -14px 40px rgba(0, 0, 0, .55);
        border-top: 1px solid rgba(255, 255, 255, .10);
    }

    /* Sheet ke sabse upar pakadne wali patti (app jaisi) */
    body.mapp .ms-grab {
        order: -1;
        flex: 0 0 auto;
        height: 22px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    body.mapp .ms-grab span {
        width: 44px;
        height: 4px;
        border-radius: 3px;
        background: rgba(255, 255, 255, .22);
    }

    /* Order form pehle (upar), positions/orders ki list neeche.
       Class se — mobile-shell.js sheet me ek segmented bar jodta hai, to
       :first-child/:last-child galat div par lag jaate the. */
    body.mapp #chartBottomV2 .ms-col-lists {
        order: 2;
        border-right: 0 !important;
        flex: 1 1 auto !important;
        min-height: 0;
        overflow-y: auto;
    }

    /* Form khud scroll kare, sheet se bahar na nikle — warna niche wala
       action button screen ke bahar chala jaata hai (sticky bhi kaam nahi
       karta, kyunki scroll container hi nahi banta). */
    body.mapp #chartBottomV2 {
        overflow: hidden !important;
    }

    body.mapp #chartBottomV2 .ms-col-form {
        order: 1;
        width: 100% !important;
        display: flex;
        flex-direction: column;
        flex: 1 1 auto !important;
        min-height: 0;
        overflow-y: auto;
        padding-bottom: 10px !important;
    }

    /* Form flex column hai — iske andar ki rows sikudni nahi chahiye,
       warna chips aadhe kat jaate hain. Jagah kam pade to scroll ho. */
    body.mapp #chartBottomV2 .ms-col-form>* {
        flex: 0 0 auto;
    }

    /* Ungli ke layak buttons/inputs */
    body.mapp #cpBuyV2,
    body.mapp #cpSellV2 {
        height: 40px !important;
        font-size: 13px !important;
        border-radius: 10px !important;
    }

    body.mapp #cpPlaceBtnV2 {
        height: 46px !important;
        font-size: 14px !important;
        border-radius: 12px !important;
    }

    body.mapp #chartBottomV2 input,
    body.mapp #chartBottomV2 select {
        height: 34px !important;
        font-size: 13px !important;
    }

    body.mapp .cb-tab {
        padding: 7px 10px !important;
        font-size: 12px !important;
    }

    /* ── Position card phone par ───────────────────────────
       Desktop par ye do lambi patti hain jo side me scroll hoti hain (25/50/
       75/Exit, phir SL · TP · EXIT · ADD). Phone par side-scroll matlab
       button dikhta hi nahi. Ab sab wrap hota hai, har hissa apni line me,
       aur buttons/inputs ungli ke layak. Handlers wahi purane — sirf dikhne
       ka tarika badla hai. */
    body.mapp .cb-pos-card:not([data-mapp="1"]) {
        border-radius: 14px;
        margin-bottom: 10px;
        border-left-width: 4px;
    }

    body.mapp .cb-pos-card:not([data-mapp="1"])>div {
        flex-wrap: wrap !important;
        overflow-x: visible !important;
        gap: 8px !important;
        padding: 10px !important;
    }

    /* Khadi lakeerein phone par jagah khaati hain */
    body.mapp .cb-pos-card:not([data-mapp="1"]) div[style*="width:1px"] {
        display: none !important;
    }

    body.mapp .cb-pos-card:not([data-mapp="1"]) .cb-st {
        min-width: 58px;
    }

    body.mapp .cb-pos-card:not([data-mapp="1"]) .cb-st .v {
        font-size: 13px;
    }

    body.mapp .cb-pos-card:not([data-mapp="1"]) .cb-pnl-main {
        font-size: 17px !important;
    }

    /* 25/50/75/Exit — poori chaudai me chaar barabar buttons */
    body.mapp .cb-pos-card:not([data-mapp="1"])>div:first-child>div:last-child {
        width: 100%;
        display: flex;
        gap: 6px;
    }

    body.mapp .cb-act-btn {
        height: 36px !important;
        font-size: 11px !important;
        flex: 1;
    }

    /* SL / TP / EXIT / ADD — har ek apni line, aur andar ka saamaan
       sikud sake (inline flex-shrink:0 tha, isse hi 404px chaudai ban rahi thi) */
    body.mapp .cb-pos-card:not([data-mapp="1"])>div:last-child>div {
        flex: 1 1 100% !important;
        flex-wrap: wrap;
        min-width: 0;
    }

    body.mapp .cb-pos-card:not([data-mapp="1"])>div:last-child>div>* {
        flex-shrink: 1 !important;
        min-width: 0;
    }

    body.mapp .cb-cbtn {
        height: 34px !important;
        font-size: 11px !important;
        padding: 0 12px !important;
    }

    body.mapp .cb-ctrl-inp {
        height: 34px !important;
        font-size: 13px !important;
        flex: 1;
        width: auto !important;
    }

    /* Leverage / quantity chips (mobile-shell.js jodta hai) */
    /* ══ Chart ka trade UI = Android app ki hubahu nakal ═════
       Naap emulator screenshots se (23-Sep-2026). Purana desktop panel
       phone par bilkul chhupa hua hai; uske elements is dhaanche me chale
       gaye hain (mobile-shell.js buildAppTradeUI). */

    /* purana panel + chart page ka nav: phone ke chart par nahi */
    body.mapp #chartBottomV2.at-dead {
        display: none !important;
    }

    body.mapp.at-on .m-nav {
        display: none !important;
    }

    body.mapp .at-back {
        flex: 0 0 auto;
        width: 30px;
        height: 30px;
        border-radius: 9px;
        display: flex;
        align-items: center;
        justify-content: center;
        color: #E7EDF5;
        background: rgba(255, 255, 255, .06);
        border: 1px solid rgba(255, 255, 255, .10);
        text-decoration: none;
        font-size: 13px;
        margin-right: 4px;
    }

    /* ── neeche wali patti ── */
    body.mapp .at-bar {
        flex: 0 0 auto;
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
        background: #0b1220;
        border-top: 1px solid rgba(255, 255, 255, .08);
    }

    body.mapp .at-barinfo {
        flex: 1 1 auto;
        min-width: 0;
    }

    body.mapp .at-barsym {
        font-size: 13px;
        color: #E7EDF5;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    body.mapp .at-barsym b {
        font-weight: 700;
    }

    body.mapp .at-barsym span {
        color: #60a5fa;
        font-weight: 700;
    }

    body.mapp .at-bartrade {
        font-size: 11px;
        color: #64748b;
        margin-top: 2px;
    }

    body.mapp .at-bar button {
        flex: 0 0 auto;
        min-width: 104px;
        height: 48px;
        border: 0;
        border-radius: 12px;
        font-size: 15px;
        font-weight: 800;
        color: #fff;
    }

    body.mapp .at-bar .at-buy {
        background: #22c55e;
    }

    body.mapp .at-bar .at-sell {
        background: #ef4444;
    }

    /* ── sheet ── */
    body.mapp .at-sheet {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 4200;
        max-height: 86vh;
        display: flex;
        flex-direction: column;
        background: #0e1626;
        border-radius: 20px 20px 0 0;
        box-shadow: 0 -16px 44px rgba(0, 0, 0, .6);
        transform: translateY(105%);
        transition: transform .22s ease;
        padding-bottom: env(safe-area-inset-bottom);
    }

    body.mapp .at-sheet.on {
        transform: translateY(0);
    }

    body.mapp .at-grab {
        height: 26px;
        display: flex;
        align-items: center;
        justify-content: center;
        flex: 0 0 auto;
    }

    body.mapp .at-grab span {
        width: 46px;
        height: 4px;
        border-radius: 3px;
        background: rgba(255, 255, 255, .22);
    }

    body.mapp .at-seg {
        display: flex;
        gap: 0;
        margin: 2px 14px 12px;
        padding: 5px;
        border-radius: 14px;
        border: 1px solid rgba(255, 255, 255, .10);
        flex: 0 0 auto;
    }

    body.mapp .at-seg button {
        flex: 1;
        height: 42px;
        border: 1px solid transparent;
        border-radius: 10px;
        background: transparent;
        color: #7C8AA0;
        font-size: 14px;
        font-weight: 700;
    }

    body.mapp .at-seg button.on {
        color: #2ee6bf;
        border-color: rgba(46, 230, 191, .55);
        background: rgba(46, 230, 191, .08);
    }

    body.mapp .at-badge {
        display: inline-block;
        min-width: 18px;
        padding: 0 5px;
        border-radius: 9px;
        background: rgba(46, 230, 191, .18);
        font-size: 11px;
        margin-left: 4px;
    }

    body.mapp .at-body {
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
        padding: 0 14px;
    }

    body.mapp .at-card {
        border: 1px solid rgba(255, 255, 255, .10);
        border-radius: 14px;
        padding: 12px;
        margin-bottom: 12px;
    }

    body.mapp .at-sym {
        display: flex;
        align-items: center;
        gap: 10px;
    }

    body.mapp .at-pill {
        display: inline-flex;
        align-items: center;
        gap: 7px;
        padding: 8px 12px;
        border-radius: 10px;
        background: rgba(255, 255, 255, .05);
        border: 1px solid rgba(255, 255, 255, .10);
        font-size: 14px;
        font-weight: 700;
        color: #E7EDF5;
    }

    body.mapp .at-pill i {
        width: 8px;
        height: 8px;
        border-radius: 50%;
        background: #22c55e;
    }

    body.mapp .at-pill #cpSymbolLabelV2 {
        font-size: 14px !important;
        color: #E7EDF5 !important;
    }

    body.mapp .at-pxwrap {
        margin-left: auto;
        text-align: right;
    }

    body.mapp .at-pxwrap #cpLivePriceV2 {
        font-size: 22px !important;
        color: #60a5fa !important;
        min-width: 0 !important;
    }

    body.mapp .at-live {
        font-size: 11px;
        color: #4ade80;
        margin-top: 2px;
    }

    /* BUY / SELL */
    body.mapp .at-side {
        display: flex;
        gap: 8px;
        padding: 6px;
    }

    body.mapp .at-side button {
        flex: 1;
        height: 52px !important;
        border: 0 !important;
        border-radius: 10px !important;
        font-size: 16px !important;
        font-weight: 800 !important;
        background: transparent !important;
        color: #7C8AA0 !important;
    }

    body.mapp .at-side #cpBuyV2.on {
        background: #22c55e !important;
        color: #fff !important;
    }

    body.mapp .at-side #cpSellV2.on {
        background: #ef4444 !important;
        color: #fff !important;
    }

    /* Order / Quantity ki lines */
    body.mapp .at-row {
        display: flex;
        align-items: center;
        gap: 8px;
        margin-bottom: 12px;
    }

    body.mapp .at-lab {
        font-size: 13px;
        color: #7C8AA0;
        flex: 0 0 auto;
    }

    body.mapp .at-chips {
        display: flex;
        gap: 8px;
        flex-wrap: nowrap;
    }

    body.mapp .at-chip {
        min-width: 56px;
        height: 44px;
        padding: 0 12px;
        border-radius: 10px;
        border: 1px solid rgba(255, 255, 255, .12);
        background: transparent;
        color: #94a3b8;
        font-size: 14px;
        font-weight: 700;
    }

    body.mapp #atType .at-chip.on {
        border-color: #3b82f6;
        color: #60a5fa;
        background: rgba(59, 130, 246, .10);
    }

    body.mapp #atLev .at-chip.on {
        border-color: #f59e0b;
        color: #fbbf24;
        background: rgba(245, 158, 11, .10);
    }

    body.mapp #atQty .at-chip.on {
        border-color: rgba(46, 230, 191, .5);
        color: #7FF0D6;
    }

    body.mapp .at-qtyrow .at-qtybox {
        position: relative;
        flex: 1 1 auto;
        min-width: 0;
    }

    body.mapp .at-qtybox i {
        position: absolute;
        left: 14px;
        top: 50%;
        transform: translateY(-50%);
        color: #64748b;
        font-size: 14px;
        pointer-events: none;
    }

    body.mapp .at-qtybox #cpQtyV2,
    body.mapp #atLim input {
        width: 100%;
        height: 56px !important;
        border-radius: 12px !important;
        border: 1px solid rgba(255, 255, 255, .12) !important;
        background: transparent !important;
        font-size: 15px !important;
        color: #E7EDF5 !important;
    }

    body.mapp .at-qtybox #cpQtyV2 {
        padding-left: 38px !important;
    }

    body.mapp #atLim>div {
        margin-bottom: 12px;
    }

    /* Leverage */
    body.mapp .at-levtop {
        display: flex;
        align-items: center;
        gap: 8px;
        margin-bottom: 12px;
    }

    body.mapp .at-levtop .at-chips {
        margin-left: auto;
    }

    body.mapp .at-levtop .at-chip {
        min-width: 52px;
        height: 38px;
        font-size: 13px;
    }

    body.mapp .at-levbot {
        display: flex;
        align-items: center;
        gap: 12px;
    }

    body.mapp .at-levbot #cpLevValV2 {
        width: 48px;
        height: 48px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 14px !important;
        color: #fbbf24 !important;
        border: 1px solid rgba(245, 158, 11, .6);
        flex: 0 0 auto;
    }

    body.mapp .at-levbot #cpLevSliderV2 {
        flex: 1 1 auto;
        height: 4px !important;
    }

    body.mapp .at-max {
        font-size: 12px;
        color: #64748b;
        flex: 0 0 auto;
    }

    /* neeche ka bada button */
    body.mapp .at-foot {
        flex: 0 0 auto;
        padding: 10px 14px calc(14px + env(safe-area-inset-bottom));
    }

    body.mapp .at-placewrap {
        position: relative;
    }

    body.mapp .at-foot #cpPlaceBtnV2 {
        width: 100% !important;
        height: 56px !important;
        border-radius: 12px !important;
        font-size: 17px !important;
        font-weight: 800 !important;
        background: #22c55e !important;
        color: #fff !important;
    }

    body.mapp .at-foot #cpPlaceBtnV2.sell {
        background: #ef4444 !important;
    }

    /* Positions / Orders panes */
    body.mapp .at-pane #cbPositionListV2,
    body.mapp .at-pane #cbOpenOrdersListV2 {
        padding: 0 0 10px !important;
    }

    /* ── Trade sheet ka app wala rang-roop ────────────────
       Android app ki trade sheet: upar segmented Trade|Positions|Orders,
       phir label + chips, aur neeche ek bada BUY/SELL button. */
    /* ── Position card (phone) ─────────────────────
       Android app ki Positions sheet jaisa: upar side + symbol + PnL,
       phir SL/TP ki % chips + price, ek bada "Set SL / TP", aur neeche
       25/50/75 + Exit All. Dhaancha mobile-shell.js banata hai (purane
       hi buttons uthakar). */
    /* Chart ke neeche position ki patti (app jaisi) */
    body.mapp .mp-bar {
        display: flex;
        align-items: center;
        gap: 6px;
        padding: 7px 10px;
        flex: 0 0 auto;
        background: rgba(18, 26, 40, .92);
        border-top: 1px solid rgba(255, 255, 255, .10);
    }

    body.mapp .mp-bar .mp-t {
        min-width: 0;
        flex: 1;
    }

    body.mapp .mp-bar .mp-sym {
        font-size: 12px;
    }

    body.mapp .mp-bar .mp-av {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }

    body.mapp .mp-bar .mp-chip {
        height: 30px !important;
        min-width: 38px !important;
        padding: 0 8px !important;
        font-size: 11px !important;
    }

    body.mapp .mp-bar .mp-bar-exit {
        background: rgba(239, 68, 68, .16) !important;
        border-color: rgba(239, 68, 68, .45) !important;
        color: #f87171 !important;
        min-width: 34px !important;
    }

    body.mapp .mp-bar .mp-bar-sltp {
        background: rgba(26, 188, 156, .16) !important;
        border-color: rgba(26, 188, 156, .45) !important;
        color: #7FF0D6 !important;
    }

    body.mapp .cb-pos-card[data-mapp="1"] {
        /* list container par inline text-align:center hai (khaali state ke
           liye) — card use apne liye reset kar leta hai */
        text-align: left;
        padding: 12px;
        border-radius: 16px;
        background: rgba(255, 255, 255, .035);
        border: 1px solid rgba(255, 255, 255, .10);
        margin-bottom: 10px;
    }

    body.mapp .mp-head {
        display: flex;
        align-items: center;
        gap: 10px;
        margin-bottom: 12px;
    }

    body.mapp .mp-av {
        width: 34px;
        height: 34px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 13px;
        font-weight: 800;
        flex: 0 0 auto;
    }

    body.mapp .mp-av.buy {
        background: rgba(34, 197, 94, .16);
        color: #4ade80;
    }

    body.mapp .mp-av.sell {
        background: rgba(239, 68, 68, .16);
        color: #f87171;
    }

    body.mapp .mp-t {
        min-width: 0;
        flex: 1;
    }

    body.mapp .mp-sym {
        font-size: 14px;
        font-weight: 700;
        color: #E7EDF5;
    }

    body.mapp .mp-sub {
        font-size: 10px;
        color: #64748b;
        margin-top: 2px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    body.mapp .mp-pnl {
        text-align: right;
        flex: 0 0 auto;
    }

    body.mapp .mp-row {
        display: flex;
        align-items: center;
        gap: 6px;
        margin-bottom: 8px;
        flex-wrap: nowrap;
    }

    body.mapp .mp-lab {
        font-size: 11px;
        font-weight: 800;
        letter-spacing: .3px;
        flex: 0 0 auto;
        width: 24px;
    }

    body.mapp .mp-lab.sl {
        color: #f87171;
    }

    body.mapp .mp-lab.tp {
        color: #4ade80;
    }

    body.mapp .mp-chip {
        height: 28px !important;
        min-width: 42px !important;
        padding: 0 8px !important;
        font-size: 11px !important;
        border-radius: 8px !important;
    }

    body.mapp input.mp-price {
        flex: 1 1 auto;
        min-width: 64px;
        width: auto !important;
        height: 30px !important;
        border-radius: 8px !important;
        text-align: right;
    }

    body.mapp .mp-set {
        width: 100%;
        height: 44px;
        margin: 4px 0 10px;
        border: 0;
        border-radius: 12px;
        font-size: 14px;
        font-weight: 800;
        color: #05221b;
        background: linear-gradient(180deg, #2ee6bf, #12a184);
    }

    body.mapp .mp-acts {
        gap: 8px;
        margin-bottom: 0;
    }

    body.mapp .mp-acts .mp-part,
    body.mapp .mp-acts .mp-exit {
        flex: 1;
        height: 38px !important;
        border-radius: 10px !important;
        font-size: 12px !important;
        font-weight: 700 !important;
    }

    body.mapp .mp-acts .mp-exit {
        background: rgba(239, 68, 68, .16) !important;
        color: #f87171 !important;
        border: 1px solid rgba(239, 68, 68, .45) !important;
    }

    body.mapp .mp-cancels {
        margin: 8px 0 0;
        justify-content: flex-end;
    }

    body.mapp .mp-cancels button {
        height: 26px !important;
        padding: 0 10px !important;
        font-size: 10px !important;
        border-radius: 8px !important;
    }

    body.mapp .ms-seg {
        order: 0;
        display: flex;
        gap: 4px;
        margin: 4px 10px 8px;
        padding: 4px;
        border-radius: 12px;
        background: rgba(255, 255, 255, .05);
        border: 1px solid rgba(255, 255, 255, .10);
        flex: 0 0 auto;
    }

    body.mapp .ms-seg button {
        flex: 1;
        height: 34px;
        border: 0;
        border-radius: 9px;
        font-size: 12px;
        font-weight: 700;
        color: #94a3b8;
        background: transparent;
    }

    body.mapp .ms-seg button.on {
        background: rgba(26, 188, 156, .18);
        color: #7FF0D6;
        box-shadow: inset 0 0 0 1px rgba(26, 188, 156, .45);
    }

    /* Quantity: ek line — "# Quantity (lots)" + 1/5/10 (app jaisa) */
    body.mapp .ms-qtyline {
        display: flex;
        align-items: center;
        gap: 8px;
        margin-bottom: 10px;
    }

    body.mapp .ms-qty {
        position: relative;
        flex: 1 1 auto;
        min-width: 0;
    }

    body.mapp .ms-qty i {
        position: absolute;
        left: 12px;
        top: 50%;
        transform: translateY(-50%);
        font-size: 12px;
        color: #64748b;
        pointer-events: none;
    }

    body.mapp .ms-qty #cpQtyV2 {
        width: 100%;
        padding-left: 30px !important;
    }

    body.mapp .ms-qtychips {
        flex: 0 0 auto;
        margin-bottom: 0;
        overflow: visible;
    }

    body.mapp .ms-qtychips .ms-chip {
        min-width: 40px !important;
        padding: 0 10px !important;
    }

    /* Sheet ke saare khaane app jaise bade aur gol */
    body.mapp #chartBottomV2 input,
    body.mapp #chartBottomV2 select {
        height: 42px !important;
        border-radius: 12px !important;
        font-size: 13px !important;
        background: rgba(255, 255, 255, .04) !important;
        border: 1px solid rgba(255, 255, 255, .12) !important;
    }

    body.mapp #chartBottomV2 .ms-chip {
        height: 38px;
        border-radius: 11px;
    }

    /* Order type ka chuna hua chip app me neela hota hai */
    body.mapp #msTypeChips .ms-chip.on {
        background: rgba(59, 130, 246, .18);
        border-color: rgba(59, 130, 246, .6);
        color: #93c5fd;
    }

    /* Leverage: label baayen, chips daayen; chuna hua chip kesariya */
    body.mapp .ms-levline {
        display: flex;
        align-items: center;
        gap: 8px;
        margin-bottom: 8px;
    }

    body.mapp .ms-levline .ms-lab {
        margin: 0;
        flex: 0 0 auto;
    }

    body.mapp .ms-levchips {
        margin-bottom: 0;
        flex: 1 1 auto;
        justify-content: flex-end;
    }

    body.mapp #msLevChips .ms-chip.on {
        background: rgba(234, 179, 8, .14);
        border-color: rgba(234, 179, 8, .55);
        color: #fbbf24;
    }

    body.mapp .ms-levwrap {
        padding: 6px 10px !important;
        border-radius: 12px !important;
        gap: 10px !important;
    }

    body.mapp #cpLevSliderV2 {
        height: 5px !important;
    }

    body.mapp .ms-max {
        font-size: 11px;
        font-weight: 700;
        color: #64748b;
        flex: 0 0 auto;
    }

    body.mapp #cpBuyV2,
    body.mapp #cpSellV2 {
        height: 46px !important;
        font-size: 14px !important;
        border-radius: 12px !important;
    }

    body.mapp .ms-lab {
        font-size: 10px;
        font-weight: 700;
        letter-spacing: .4px;
        text-transform: uppercase;
        color: #64748b;
        margin: 2px 0 5px;
    }

    /* Order type ab chips me hai — purana select phone par chhupa,
       aur uska 3-column grid ek column ka ho jaata hai */
    body.mapp #cpTypeV2 {
        display: none !important;
    }

    body.mapp #chartBottomV2 div[style*="60px 1fr 1fr"] {
        grid-template-columns: 1fr !important;
    }

    /* AI page ka "1fr 1fr → 1 column" rule trade panel par bhi lag jaata tha
       (chart bhi .main-content ke andar hai) — BUY/SELL neeche-upar ho gaye.
       Sheet ke andar do column wapas. */
    body.mapp #chartBottomV2 div[style*="grid-template-columns:1fr 1fr"] {
        grid-template-columns: 1fr 1fr !important;
    }

    /* Action button sheet ke sabse neeche, form ke scroll se bahar */
    body.mapp #chartBottomV2 .ms-place {
        order: 3;
        flex: 0 0 auto;
        padding: 8px 10px calc(10px + env(safe-area-inset-bottom));
        background: rgba(10, 16, 28, .96);
        border-top: 1px solid rgba(255, 255, 255, .08);
    }

    /* Leverage ka number app jaisa gol badge */
    body.mapp #cpLevValV2 {
        width: 38px;
        height: 38px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 12px !important;
        background: rgba(234, 179, 8, .12);
        border: 1px solid rgba(234, 179, 8, .45);
        flex: 0 0 auto;
    }

    /* Bada action button — app me ye sheet ka sabse neeche wala hissa hai */
    body.mapp #cpPlaceBtnV2 {
        width: 100% !important;
        height: 50px !important;
        font-size: 15px !important;
        font-weight: 800 !important;
        border-radius: 14px !important;
        letter-spacing: .3px;
    }

    body.mapp .ms-chips {
        display: flex;
        gap: 6px;
        overflow-x: auto;
        margin-bottom: 8px;
        scrollbar-width: none;
    }

    body.mapp .ms-chips::-webkit-scrollbar {
        display: none;
    }

    body.mapp .ms-chip {
        flex: 0 0 auto;
        height: 32px;
        min-width: 48px;
        padding: 0 12px;
        border-radius: 9px;
        font-size: 12px;
        font-weight: 700;
        color: #94a3b8;
        background: rgba(255, 255, 255, .05);
        border: 1px solid rgba(255, 255, 255, .12);
    }

    body.mapp .ms-chip.on {
        background: rgba(26, 188, 156, .18);
        border-color: rgba(26, 188, 156, .5);
        color: #7FF0D6;
    }

    body.mapp .ms-chip.ms-step {
        min-width: 42px;
        font-size: 17px;
        font-weight: 800;
        color: #e2e8f0;
    }

    /* ── Purane (desktop) pages phone par tootein nahi ─────
       Journal / Risk / Settings wagairah abhi bhi Bootstrap wale desktop
       page hain. Inhe app jaisa banane ka kaam alag hai — yahan sirf itna
       ki phone par padhne layak rahein: header stack ho, filter poori
       chaudai lein, aur upar status bar ke neeche se shuru hon. */
    body.mapp .container-fluid,
    body.mapp .container {
        padding-left: 14px !important;
        padding-right: 14px !important;
        padding-top: calc(10px + env(safe-area-inset-top));
    }

    body.mapp .d-flex.justify-content-between {
        flex-wrap: wrap;
        gap: 10px;
    }

    body.mapp h1 {
        font-size: 22px;
    }

    body.mapp h2 {
        font-size: 20px;
    }

    body.mapp h3 {
        font-size: 17px;
    }

    body.mapp .form-select,
    body.mapp .form-control,
    body.mapp .form-select-sm,
    body.mapp .form-control-sm {
        width: 100% !important;
        min-width: 0;
    }

    body.mapp .d-flex.gap-2.flex-wrap {
        width: 100%;
    }

    body.mapp .d-flex.gap-2.flex-wrap>* {
        flex: 1 1 46%;
    }

    /* Bootstrap wale cards ko app jaisa glass look */
    body.mapp .card {
        border-radius: 16px !important;
        background: var(--m-glass) !important;
        border: 1px solid var(--m-stroke) !important;
    }

    body.mapp .card.p-3 {
        padding: 12px !important;
    }

    /* Inline "space-between" wali patti phone par tod do (AI coach card
       jaisi jagah par text aur button ek doosre me ghus rahe the) */
    body.mapp .main-content div[style*="space-between"] {
        flex-wrap: wrap;
        gap: 8px;
    }

    body.mapp canvas {
        max-height: 220px !important;
    }

    body.mapp table {
        font-size: 12px;
    }

    body.mapp .table-responsive {
        -webkit-overflow-scrolling: touch;
    }

    /* ── AI pages ──────────────────────────────────────────
       AI Chat do-column ka desktop layout hai: baayen purani chats,
       daayen chat. Phone par chat sirf ek tihai chaudai me sikud jaata tha.
       Ab chat poori chaudai leta hai; purani chats ki list phone par chhupi
       rehti hai (naya chat wahi "New Chat" button se ban jaata hai). */
    body.mapp #aiConvSidebar {
        display: none !important;
    }

    body.mapp #aiAssistantPage {
        height: calc(100vh - var(--m-nav-h)) !important;
    }

    /* AI Live Analyzer ka 300px + baaki wala grid phone par ek column */
    body.mapp .main-content div[style*="grid-template-columns:300px"],
    body.mapp .main-content div[style*="grid-template-columns: 300px"] {
        grid-template-columns: 1fr !important;
    }

    body.mapp .main-content div[style*="grid-template-columns:1fr 1fr"] {
        grid-template-columns: 1fr !important;
    }

    /* ── Settings page phone par ───────────────────────────
       Tabs (Brokers / Preferences / Profile / Security) ek line me nahi
       aate — ab side me scroll hote hain, aur har panel card jaisa. */
    body.mapp .settings-tab {
        flex: 0 0 auto;
        height: 36px;
        font-size: 12px !important;
        padding: 0 14px !important;
        border-radius: 999px !important;
        white-space: nowrap;
    }

    body.mapp .settings-tabs,
    body.mapp .settings-tab-bar {
        display: flex;
        gap: 7px;
        overflow-x: auto;
        scrollbar-width: none;
        padding-bottom: 4px;
    }

    body.mapp .settings-tabs::-webkit-scrollbar,
    body.mapp .settings-tab-bar::-webkit-scrollbar {
        display: none;
    }

    /* Modal (PIN / broker form) phone par poori chaudai, neeche se */
    body.mapp .modal-dialog {
        margin: 0;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        max-width: 100%;
    }

    body.mapp .modal-content {
        border-radius: 18px 18px 0 0;
        border: 1px solid var(--m-stroke);
    }

    /* ── Page khulne par halka fade (app jaisa) ──────────── */
    body.mapp .main-content {
        animation: mFade .18s ease-out;
    }

    @keyframes mFade {
        from {
            opacity: .35;
            transform: translateY(6px);
        }

        to {
            opacity: 1;
            transform: none;
        }
    }

    /* ── Pull to refresh ka indicator (mobile-shell.js) ──── */
    .m-ptr {
        position: fixed;
        top: 0;
        left: 50%;
        transform: translate(-50%, -100%);
        z-index: 5000;
        margin-top: env(safe-area-inset-top);
        width: 34px;
        height: 34px;
        border-radius: 50%;
        background: rgba(18, 26, 40, .92);
        border: 1px solid var(--m-stroke);
        color: var(--m-teal);
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 14px;
        box-shadow: 0 6px 18px rgba(0, 0, 0, .45);
        transition: transform .12s linear;
    }

    .m-ptr.spin i {
        animation: mSpin .8s linear infinite;
    }

    @keyframes mSpin {
        to {
            transform: rotate(360deg);
        }
    }

    /* Install banner */
    /* ── iPhone/iPad ka install hint ───────────────────────
       iOS Safari kabhi apna install prompt nahi dikhata (beforeinstallprompt
       sirf Android/Chrome par hai). Wahan home screen par icon tabhi aata hai
       jab user khud Share → "Add to Home Screen" kare. Isliye ek chhota
       fixed hint — nav ke upar, chart page par bhi dikhe (wahan .main-content
       hota hi nahi), aur ek baar band kar diya to dobara nahi aata. */
    .m-ios-tip {
        position: fixed;
        left: 12px;
        right: 12px;
        bottom: calc(var(--m-nav-h) + env(safe-area-inset-bottom) + 14px);
        z-index: 4100;
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 11px 12px;
        border-radius: 15px;
        background: rgba(18, 26, 40, .94);
        backdrop-filter: blur(18px);
        -webkit-backdrop-filter: blur(18px);
        border: 1px solid rgba(26, 188, 156, .35);
        box-shadow: 0 10px 30px rgba(0, 0, 0, .5);
        font-size: 12px;
        line-height: 1.4;
        color: var(--m-text);
    }

    /* Chart par thoda aur upar — warna trade-sheet ka handle dhak jaata hai */
    body.mapp.mchart .m-ios-tip {
        bottom: calc(var(--m-nav-h) + env(safe-area-inset-bottom) + 46px);
    }

    .m-ios-tip b {
        color: var(--m-teal);
    }

    .m-ios-tip .s {
        display: inline-flex;
        width: 18px;
        height: 18px;
        border-radius: 5px;
        background: rgba(26, 188, 156, .18);
        color: var(--m-teal);
        align-items: center;
        justify-content: center;
        font-size: 10px;
        vertical-align: -3px;
        margin: 0 2px;
    }

    .m-ios-tip .x {
        margin-left: auto;
        border: 0;
        background: transparent;
        color: var(--m-muted);
        font-size: 16px;
        padding: 0 2px;
        flex-shrink: 0;
    }

    .m-install {
        display: flex;
        align-items: center;
        gap: 10px;
        margin: 12px 14px 0;
        padding: 11px 12px;
        border-radius: 15px;
        background: var(--m-teal-soft);
        border: 1px solid rgba(26, 188, 156, .35);
        font-size: 12px;
    }

    .m-install button {
        margin-left: auto;
        border: 0;
        border-radius: 9px;
        padding: 7px 12px;
        font-size: 11px;
        font-weight: 800;
        background: var(--m-teal);
        color: #05221b;
    }

    .m-install .x {
        border: 0;
        background: transparent;
        color: var(--m-muted);
        font-size: 15px;
        padding: 0 2px;
        margin-left: 2px;
    }
}

/* Standalone (home screen se khula) — upar ka safe area aur bhi chahiye */
@media (display-mode: standalone) {
    body.mapp .m-head {
        padding-top: calc(20px + env(safe-area-inset-top));
    }
}
