/* 41-v2-nav.css — the new interface's navigation (body.ui-v2, ui/nav-v2.js): the phone bottom bar
   (اليوم، العمليات، التحليل، the logo → تسجيل عملية، أموالي، الخطة، القائمة), the top of اليوم, القائمة, and the
   desktop sidebar's five sections + القائمة.
   The bar is 60px tall (6 + 48 + 6) plus the safe area, about the classic 62px, so the fixed things that sit
   above the bar (page FABs, sheets, chips, the bank-SMS screen) keep their classic place (--v2-nav-extra 0). */

.ui-v2 { --v2-nav-h: 60px; --v2-nav-extra: 0px; }

/* ── Phone ── */
@media (max-width: 768px) {
    .ui-v2 .v2-nav {
        position: fixed; inset-inline: 0; bottom: 0; z-index: 9000;
        display: flex; align-items: center; gap: 0;
        padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
        background: var(--c-surface); border-top: 1px solid var(--c-border);
        box-shadow: 0 -4px 16px rgba(15,23,42,.06);
    }
    /* Keyboard up, a window open, or the capture sheet open: the bar steps aside. */
    .ui-v2.kb-open .v2-nav,
    .ui-v2.ledger-sheet-open .v2-nav,
    body.ui-v2:has(.modal-overlay.active) .v2-nav { display: none !important; }

    .ui-v2 .v2-nav__item {
        flex: 1 1 0; min-width: 0; min-height: 48px; padding: 0;
        display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
        border: 0; background: none; cursor: pointer; -webkit-tap-highlight-color: transparent;
        font: inherit; font-size: 11px; font-weight: 600; line-height: 1.35; color: var(--c-text-muted);
        transition: color var(--mo-base) var(--ease-out);
    }
    .ui-v2 .v2-nav__ic {
        width: 44px; height: 26px; border-radius: var(--radius-pill); display: grid; place-items: center; font-size: 16px;
        transition: background-color var(--mo-base) var(--ease-out), transform var(--mo-fast) var(--ease-out);
    }
    .ui-v2 .v2-nav__item:active .v2-nav__ic { transform: scale(.9); }
    .ui-v2 .v2-nav__label { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .ui-v2 .v2-nav__item.is-on { color: var(--c-primary); }
    .ui-v2 .v2-nav__item.is-on .v2-nav__ic { background: var(--c-primary-soft); }

    /* The logo in a white circle with an indigo ring, raised above the bar. */
    .ui-v2 .v2-nav__add {
        flex: none; width: 54px; height: 54px; margin: -20px 2px 0; padding: 0;
        border-radius: 50%; border: 2.5px solid var(--c-primary); background: #fff;
        box-shadow: 0 4px 12px rgba(79,70,229,.25); display: grid; place-items: center; cursor: pointer; overflow: hidden;
        -webkit-tap-highlight-color: transparent; transition: transform var(--mo-fast) var(--ease-out);
    }
    .ui-v2 .v2-nav__add:active { transform: scale(.92); }
    /* The icon file has wide white margins: draw it larger and let the circle clip the white edge, so the bag fills it. */
    /* Nudged so the bag itself (not the image box) sits in the exact middle of the ring. */
    .ui-v2 .v2-nav__add img { width: 54px; height: 54px; max-width: none; display: block; transform: translate(2px, -2px); }

    /* Room for the taller bar under every page, and the things that float above it. */
    .ui-v2 .main-content > .view,
    .ui-v2 #view-dashboard { padding-bottom: calc(var(--v2-nav-h) + 16px + env(safe-area-inset-bottom, 0px)) !important; }
    /* Pages with a floating add button: room for the button above the taller bar. */
    .ui-v2 #view-subscriptions.active,
    .ui-v2 #view-transactions.active { padding-bottom: calc(var(--v2-nav-h) + 90px + env(safe-area-inset-bottom, 0px)) !important; }
    .ui-v2 .fab,
    .ui-v2 .view.active > .page-fab { bottom: calc(82px + var(--v2-nav-extra) + env(safe-area-inset-bottom, 0px)); }
    .ui-v2 .mobile-sheet { bottom: calc(60px + var(--v2-nav-extra) + env(safe-area-inset-bottom, 0px)); }
    .ui-v2 .ai-modal { bottom: calc(66px + var(--v2-nav-extra) + env(safe-area-inset-bottom, 0px)); }
    .ui-v2 .ai-modal-backdrop { bottom: calc(60px + var(--v2-nav-extra) + env(safe-area-inset-bottom, 0px)) !important; }
    .ui-v2 .native-chip { bottom: calc(78px + var(--v2-nav-extra) + env(safe-area-inset-bottom, 0px)); }
    .ui-v2 .native-chip + .native-chip { bottom: calc(134px + var(--v2-nav-extra) + env(safe-area-inset-bottom, 0px)); }
    /* ينتظر قرارك reaches the screen's edge under the bar (the bar sits above it), so no strip of the page
       behind ever shows between them; its content and «تأكيد الجاهز» bar stop above the bar. */
    .ui-v2 .bank-sms-screen { bottom: 0; }
    .ui-v2.bank-sms-screen-open .v2-nav { z-index: 9600; }
    .ui-v2 .bank-sms-screen :is(.bsms-body, .v2-inbox-body) { padding-bottom: calc(var(--v2-nav-h) + 16px + env(safe-area-inset-bottom, 0px)); }
    /* With «تأكيد الجاهز» the bar under the list takes the room above the bottom bar instead of the list. */
    .ui-v2 .bank-sms-screen .v2-inbox-body:has(+ .v2-inbox-foot) { padding-bottom: 16px; }
    .ui-v2 .bank-sms-screen .v2-inbox-foot { padding-bottom: calc(var(--v2-nav-h) + 12px + env(safe-area-inset-bottom, 0px)); }
    .ui-v2.kb-open .bank-sms-screen :is(.bsms-body, .v2-inbox-body) { padding-bottom: 16px; }
    .ui-v2.kb-open .bank-sms-screen .v2-inbox-foot { padding-bottom: 12px; }
    /* The capture sheet (today's add form) has the bar out of the way: it sits on the screen's edge. */
    .ui-v2.ledger-sheet-open #view-ledger.active {
        bottom: 0 !important;
        max-height: calc(100dvh - 80px) !important;
        padding-bottom: env(safe-area-inset-bottom, 0px) !important;
    }
    .ui-v2.ledger-sheet-open::before { bottom: 0; }

    /* The top of اليوم: greeting and date, then the eye, bank SMS and notifications (القائمة is in the bar). */
    .ui-v2 .v2-today-top { display: flex; align-items: center; gap: 8px; padding: 4px 0 12px; }

    /* القائمة on the phone */
    .ui-v2 #view-menu .v2-card { margin: 0; }
}

/* ── Desktop: the sidebar lists the five sections + القائمة instead of the classic menu ── */
@media (min-width: 769px) {
    .ui-v2 .v2-side { display: flex; flex-direction: column; gap: 8px; flex-grow: 1; }
    .ui-v2 .v2-side__item {
        display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 12px 16px;
        border: 0; border-radius: var(--radius-sm); background: none; cursor: pointer;
        font: inherit; font-weight: 500; color: var(--c-text-muted); text-align: start;
        transition: transform var(--mo-fast) var(--ease-out);
    }
    .ui-v2 .v2-side__item i { width: 20px; text-align: center; }
    .ui-v2 .v2-side__item.is-on { background: var(--c-primary-soft); color: var(--c-primary); font-weight: 700; }
    .ui-v2 .v2-side__capture {
        display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; margin-bottom: 8px;
        border: 0; border-radius: var(--radius-md); background: var(--c-primary); color: var(--c-on-primary);
        font: inherit; font-weight: 700; cursor: pointer;
    }
    .ui-v2 #view-menu { max-width: 720px; }
}
@media (min-width: 769px) and (hover: hover) and (pointer: fine) {
    .ui-v2 .v2-side__item:hover { background: var(--c-primary-soft); color: var(--c-primary); }
    .ui-v2 .v2-side__capture:hover { background: var(--c-primary-hover); }
}
