/* ==========================================================================
   MintYourCard v2 - App Shell
   ==========================================================================
   Layout, navigation, top bar, view containers, loading screen.
   Mobile-first: base styles = mobile. @media (min-width) for larger.
   All classes prefixed v2- to avoid v1 collisions.
   ========================================================================== */


/* ==========================================================================
   1. GLOBAL RESET & BASE
   ========================================================================== */

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

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
    scroll-behavior: smooth;
    overscroll-behavior: none;
}

body {
    margin: 0;
    background-color: var(--v2-bg-app);
    color: var(--v2-text-primary);
    font-family: var(--v2-font-body);
    font-size: var(--v2-text-base);
    line-height: var(--v2-leading-normal);
    overflow: hidden;
    overscroll-behavior: none;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    /* Prevent text selection and image callout on long press (native app feel) */
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

/* Re-enable text selection for actual input fields */
input,
textarea,
[contenteditable] {
    -webkit-user-select: text;
    user-select: text;
}

/* Accessibility: visually hidden but readable by screen readers */
.v2-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Accessibility: skip link */
.v2-skip-link {
    position: absolute;
    top: -100%;
    left: var(--v2-space-4);
    z-index: calc(var(--v2-z-tooltip) + 1);
    padding: var(--v2-space-2) var(--v2-space-4);
    background: var(--v2-accent);
    color: var(--v2-text-inverse);
    font-weight: var(--v2-font-semibold);
    font-size: var(--v2-text-sm);
    border-radius: var(--v2-radius-md);
    text-decoration: none;
    transition: top var(--v2-duration-fast) var(--v2-ease-out-expo);
}

.v2-skip-link:focus {
    top: var(--v2-space-2);
}


/* ==========================================================================
   2. MAIN CONTAINER
   ========================================================================== */

.v2-main {
    position: relative;
    width: 100%;
    height: 100vh; /* fallback for browsers without dvh */
    overflow: hidden;
}

/* Modern browsers: prefer dvh (dynamic viewport height — accounts for mobile browser chrome) */
@supports (height: 100dvh) {
    .v2-main {
        height: 100dvh;
    }
}


/* ==========================================================================
   3. VIEW CONTAINERS
   ========================================================================== */

.v2-view {
    display: block; /* override inline display:none from critical CSS once shell.css loads */
    position: absolute;
    inset: 0;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior-y: contain;
    touch-action: pan-y; /* allow vertical scroll only, prevent double-tap-zoom on empty space */

    background-color: var(--v2-bg-app);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--v2-duration-page) var(--v2-ease-out-expo);
    padding-top: calc(var(--v2-top-bar-height) + var(--v2-safe-top));
    padding-bottom: 0;
    padding-left: var(--v2-safe-left);
    padding-right: var(--v2-safe-right);

    /* Smooth scrollbar on webkit */
    scrollbar-width: thin;
    scrollbar-color: var(--v2-border-default) transparent;
}

.v2-view::-webkit-scrollbar {
    width: 4px;
}

.v2-view::-webkit-scrollbar-track {
    background: transparent;
}

.v2-view::-webkit-scrollbar-thumb {
    background: var(--v2-border-default);
    border-radius: var(--v2-radius-full);
}

/* Active view */
.v2-view--active {
    opacity: 1;
    pointer-events: auto;
}

/* Overlay views (card detail) sit above everything */
.v2-view--overlay {
    z-index: var(--v2-z-overlay);
}

/* View page transition animations (classes added/removed by nav.js)
   Enter animations: NO opacity fade — entering view is immediately opaque
   with its solid background, preventing bleed-through of old view.
   Exit animations: fade out + slide (old view disappears underneath). */

.v2-page-entering {
    opacity: 1;
    transition: none;
    animation: v2-page-enter var(--v2-duration-page) var(--v2-ease-out-expo) forwards;
}

.v2-page-exiting {
    animation: v2-page-exit var(--v2-duration-page) var(--v2-ease-out-expo) forwards;
}

.v2-page-back-entering {
    opacity: 1;
    transition: none;
    animation: v2-page-back-enter var(--v2-duration-page) var(--v2-ease-out-expo) forwards;
}

.v2-page-back-exiting {
    animation: v2-page-back-exit var(--v2-duration-page) var(--v2-ease-out-expo) forwards;
}

@keyframes v2-page-enter {
    from { transform: translateX(8%); }
    to   { transform: translateX(0); }
}

@keyframes v2-page-exit {
    from { opacity: 1; transform: translateX(0); }
    to   { opacity: 0; transform: translateX(-4%); }
}

@keyframes v2-page-back-enter {
    from { transform: translateX(-8%); }
    to   { transform: translateX(0); }
}

@keyframes v2-page-back-exit {
    from { opacity: 1; transform: translateX(0); }
    to   { opacity: 0; transform: translateX(4%); }
}

/* Reduced motion: disable page transitions */
@media (prefers-reduced-motion: reduce) {
    .v2-page-entering,
    .v2-page-exiting,
    .v2-page-back-entering,
    .v2-page-back-exit {
        animation: none;
    }

    .v2-view {
        transition: opacity var(--v2-duration-fast) linear;
    }
}


/* ==========================================================================
   4. LOADING SCREEN
   ========================================================================== */

.v2-loading-screen {
    position: fixed;
    inset: 0;
    z-index: calc(var(--v2-z-tooltip) + 10);
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--v2-bg-app);
}

.v2-loading-screen__logo {
    width: 64px;
    height: 64px;
    object-fit: contain;
    animation: v2-pulse-logo 1.8s var(--v2-ease-in-out) infinite;
}

.v2-loading-screen__spinner {
    position: absolute;
    bottom: max(env(safe-area-inset-bottom, 20px), 48px);
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.10);
    border-top-color: rgba(255, 255, 255, 0.50);
    border-radius: 50%;
    animation: v2-loading-spin 0.7s linear infinite;
}

@keyframes v2-loading-spin {
    to { transform: rotate(360deg); }
}

@keyframes v2-pulse-logo {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.5;
        transform: scale(0.92);
    }
}

/* Fade out when app is ready */
.v2-loading-screen.v2-fade-out {
    opacity: 0;
    transition: opacity 300ms var(--v2-ease-out-expo);
    pointer-events: none;
}


/* ==========================================================================
   5. TOP BAR
   ========================================================================== */

.v2-top-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: var(--v2-z-sticky);
    height: calc(var(--v2-top-bar-height) + var(--v2-safe-top));
    padding-top: var(--v2-safe-top);
    padding-left: var(--v2-space-4);
    padding-right: var(--v2-space-4);
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: var(--v2-space-2);
    background: transparent;
    transition: background-color 0.3s var(--v2-ease-out-expo),
                backdrop-filter 0.3s var(--v2-ease-out-expo),
                -webkit-backdrop-filter 0.3s var(--v2-ease-out-expo);
}

/* Solid state (on scroll or sub-pages) — solid background to reduce GPU layers */
.v2-top-bar--solid {
    background-color: rgba(0, 0, 0, 0.96);
    border-bottom: 1px solid var(--v2-border-subtle);
}

/* Hidden state (most main views — dashboard, gallery, collection, etc.) */
.v2-top-bar--hidden {
    transform: translateY(-100%);
    pointer-events: none;
    transition: transform var(--v2-duration-page) var(--v2-ease-out-expo);
}

/* When top bar is hidden, views don't need clearance padding.
   Only sub-views (card-detail, magic-brush) show the top bar and
   need the default padding-top from .v2-view. */
.v2-top-bar--hidden ~ .v2-main .v2-view {
    padding-top: 0;
}

.v2-top-bar__back {
    flex-shrink: 0;
}

.v2-top-bar__title {
    flex: 1;
    font-family: var(--v2-font-display);
    font-size: var(--v2-text-lg);
    font-weight: var(--v2-font-semibold);
    color: var(--v2-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 0;
    transition: opacity var(--v2-duration-normal) var(--v2-ease-out-expo);
}

/* Title visible when top bar is solid */
.v2-top-bar--solid .v2-top-bar__title {
    opacity: 1;
}

.v2-top-bar__actions {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: var(--v2-space-2);
    flex-shrink: 0;
}


/* ==========================================================================
   6. ICON BUTTON (shared)
   ========================================================================== */

.v2-btn--icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--v2-touch-target);
    height: var(--v2-touch-target);
    min-width: var(--v2-touch-target);
    min-height: var(--v2-touch-target);
    padding: 0;
    background: none;
    border: none;
    border-radius: var(--v2-radius-full);
    color: var(--v2-text-primary);
    font-size: var(--v2-text-lg);
    cursor: pointer;
    position: relative;
    -webkit-tap-highlight-color: transparent;
    transition: background-color var(--v2-duration-fast) var(--v2-ease-out-expo);
}

.v2-btn--icon:hover {
    background-color: var(--v2-bg-elevated-hover);
}

.v2-btn--icon:active {
    background-color: var(--v2-bg-elevated);
    transform: scale(0.92);
}

.v2-btn--icon:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.5);
    outline-offset: 2px;
}


/* ==========================================================================
   7. NOTIFICATION BADGE
   ========================================================================== */

.v2-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    min-width: 8px;
    height: 8px;
    border-radius: var(--v2-radius-full);
    font-size: 0;
    line-height: 1;
}

.v2-badge--error {
    background-color: var(--v2-error);
}

/* Badge with count */
.v2-badge[data-count] {
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    font-size: 10px;
    font-weight: var(--v2-font-bold);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    top: 2px;
    right: 2px;
}


/* Bottom fade — gradient behind navbar so content doesn't pollute the bar */
.v2-main::after {
    content: '';
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: 140px;
    background: linear-gradient(to bottom, transparent 0%, rgba(0, 0, 0, 0.75) 100%);
    pointer-events: none;
    z-index: calc(var(--v2-z-sticky) - 1);
    transition: opacity var(--v2-duration-normal) var(--v2-ease-out-expo);
}

/* Hide bottom fade when a modal is open (body overflow hidden) */
body[style*="overflow: hidden"] .v2-main::after {
    opacity: 0;
}

/* Hide bottom fade when submit-card view is active (full-screen, no navbar) */
.v2-main:has(#v2-submit-card.v2-view--active)::after {
    opacity: 0;
}


/* ==========================================================================
   7b. STICKY CTA — "Demander un prégrade"
   ========================================================================== */

.v2-pregrade-cta {
    position: fixed;
    /* Sits right above the navbar: max(safe-bottom, 10px) + navbar height (64px) + spacing (10px) */
    bottom: calc(max(var(--v2-safe-bottom), 10px) + 64px + 10px);
    left: 16px;
    right: 16px;
    z-index: var(--v2-z-sticky);
    height: 54px;
    border-radius: 999px;

    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;

    /* White CTA — full opacity */
    background: #fff;
    color: #000;
    text-decoration: none;
    font-family: var(--v2-font-family);
    font-size: 15px;
    font-weight: var(--v2-font-semibold);
    letter-spacing: -0.01em;

    border: none;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);

    /* Spring show/hide — syncs with navbar */
    transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1),
                opacity 0.3s var(--v2-ease-out-expo);
}

.v2-pregrade-cta i {
    font-size: 16px;
}

/* Tap feedback */
.v2-pregrade-cta:active {
    transform: scale(0.97);
    transition-duration: 0.06s;
}

/* Hidden state — syncs with navbar hide */
.v2-pregrade-cta--hidden {
    transform: translateY(calc(100% + 100px));
    opacity: 0;
    pointer-events: none;
}


/* ==========================================================================
   8. BOTTOM NAVIGATION — iOS 26 Liquid Glass
   ========================================================================== */

.v2-bottom-nav {
    position: fixed;
    bottom: max(var(--v2-safe-bottom), 10px);
    left: 16px;
    right: 16px;
    z-index: var(--v2-z-sticky);
    height: 64px;
    border-radius: 999px;
    touch-action: manipulation; /* prevent double-tap-to-zoom */

    /* Liquid Glass — white-tinted frosted material (lighter than surroundings in dark mode) */
    background: var(--v2-bg-nav);
    -webkit-backdrop-filter: var(--v2-blur-nav);
    backdrop-filter: var(--v2-blur-nav);

    /* Specular highlight + subtle border */
    border: 0.5px solid rgba(255, 255, 255, 0.12);
    box-shadow:
        0 4px 24px rgba(0, 0, 0, 0.35),
        0 1px 4px rgba(0, 0, 0, 0.15),
        inset 0 0.5px 0 rgba(255, 255, 255, 0.15);

    display: flex;
    flex-direction: row;
    justify-content: space-around;
    align-items: center;
    padding: 0 3px;

    /* Spring show/hide */
    transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1),
                opacity 0.3s var(--v2-ease-out-expo);
}

/* Mobile: restore blur (overrides var(--v2-blur-nav):none from tokens.css) */
@media (max-width: 768px) {
    .v2-bottom-nav {
        -webkit-backdrop-filter: saturate(140%) blur(12px);
        backdrop-filter: saturate(140%) blur(12px);
    }
}

/* Hidden state (auth, card detail) — drops below screen */
.v2-bottom-nav--hidden {
    transform: translateY(calc(100% + 28px));
    opacity: 0;
    pointer-events: none;
}

/* Nav items */
.v2-bottom-nav__item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    flex: 1;
    height: 50px;
    padding: 0;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.40);
    font-family: var(--v2-font-body);
    font-size: 10px;
    font-weight: var(--v2-font-medium);
    letter-spacing: 0.02em;
    line-height: 1;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    position: relative;
    transition: color 0.25s var(--v2-ease-out-expo);
}

/* Icon */
.v2-bottom-nav__item i {
    font-size: 21px;
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Label */
.v2-bottom-nav__item span {
    transition: opacity 0.2s var(--v2-ease-out-expo);
}

/* --- Active tab --- */
.v2-bottom-nav__item.active {
    color: rgba(255, 255, 255, 0.95);
}

/* Sliding pill indicator — moves organically between tabs (GPU transform) */
.v2-bottom-nav__pill {
    position: absolute;
    top: 3px;
    bottom: 3px;
    left: 3px; /* match nav padding — uniform 3px inset on all sides */
    width: calc((100% - 6px) / 5); /* 1/5 of usable space = same as each item slot */
    background: rgba(255, 255, 255, 0.10);
    border-radius: 999px;
    pointer-events: none;
    transform: translateX(calc(var(--active-index, 0) * 100%)); /* move exactly 1 slot per step */
    transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 0;
}

/* Logo icon in nav — matches Font Awesome icon sizing */
.v2-bottom-nav__logo {
    display: block;
    opacity: 0.40; /* match inactive FA icons */
    transition: opacity var(--v2-duration-fast) var(--v2-ease-out-expo),
                transform var(--v2-duration-fast) var(--v2-ease-spring);
}

.v2-bottom-nav__item.active .v2-bottom-nav__logo {
    opacity: 0.95; /* match active FA icons */
}

/* Active icon — subtle scale */
.v2-bottom-nav__item.active i,
.v2-bottom-nav__item.active .v2-bottom-nav__logo {
    transform: scale(1.08);
}

/* Active label — slightly bolder */
.v2-bottom-nav__item.active span {
    font-weight: var(--v2-font-semibold);
}

/* --- Tap feedback (spring down, then spring back) --- */
.v2-bottom-nav__item:active i {
    transform: scale(0.78);
    transition-duration: 0.06s;
    transition-timing-function: linear;
}

/* Focus visible (keyboard) */
.v2-bottom-nav__item:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.5);
    outline-offset: 2px;
    border-radius: var(--v2-radius-md);
}

/* Indicator div — deprecated (hidden) */
.v2-bottom-nav__indicator {
    display: none;
}


/* ==========================================================================
   9. TOAST CONTAINER
   ========================================================================== */

.v2-toast-container {
    position: fixed;
    bottom: calc(64px + max(var(--v2-safe-bottom), 10px) + 16px);
    left: var(--v2-space-4);
    right: var(--v2-space-4);
    z-index: var(--v2-z-toast);
    display: flex;
    flex-direction: column;
    gap: var(--v2-space-2);
    pointer-events: none;
}

.v2-toast-container > * {
    pointer-events: auto;
}


/* ==========================================================================
   10. INTERACTIVE TOUCH FEEDBACK
   ========================================================================== */

.v2-interactive {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.v2-interactive:active {
    opacity: 0.7;
    transition: opacity var(--v2-duration-instant);
}


/* ==========================================================================
   11. DESKTOP / TABLET BREAKPOINTS
   ========================================================================== */

/* Tablet (768px+) */
@media (min-width: 768px) {
    .v2-top-bar {
        padding-left: var(--v2-space-6);
        padding-right: var(--v2-space-6);
    }

    .v2-toast-container {
        left: auto;
        right: var(--v2-space-6);
        max-width: 400px;
    }
}

/* ==========================================================================
   SIDEBAR — hidden on mobile, shown on desktop
   ========================================================================== */

.v2-sidebar {
    display: none; /* mobile: hidden. Desktop block below enables it */
}

/* Desktop (1024px+): replace bottom nav with sidebar */
@media (min-width: 1024px) {

    /* ── Sidebar panel ── */
    .v2-sidebar {
        display: flex;
        flex-direction: column;
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: var(--v2-sidebar-width);
        z-index: var(--v2-z-sticky);
        background: rgba(10, 10, 14, 0.92);
        backdrop-filter: saturate(180%) blur(20px);
        -webkit-backdrop-filter: saturate(180%) blur(20px);
        border-right: 0.5px solid rgba(255, 255, 255, 0.08);
        padding: var(--v2-space-5) 0 var(--v2-space-5);
        box-sizing: border-box;
    }

    /* Hidden (auth view, overlays) */
    .v2-sidebar--hidden {
        display: none;
    }

    /* ── Brand ── */
    .v2-sidebar__brand {
        display: flex;
        align-items: center;
        gap: var(--v2-space-3);
        padding: 0 var(--v2-space-4) var(--v2-space-5);
        border-bottom: 0.5px solid rgba(255, 255, 255, 0.06);
        margin-bottom: var(--v2-space-3);
        flex-shrink: 0;
    }

    .v2-sidebar__brand-logo {
        width: 28px;
        height: 28px;
        flex-shrink: 0;
        border-radius: 6px; /* squircle */
    }

    .v2-sidebar__brand-name {
        font-family: var(--v2-font-display);
        font-size: 13px;
        font-weight: var(--v2-font-bold);
        color: var(--v2-text-primary);
        letter-spacing: -0.01em;
        white-space: nowrap;
    }

    /* ── Nav items ── */
    .v2-sidebar__nav {
        flex: 1;
        display: flex;
        flex-direction: column;
        gap: 2px;
        padding: 0 var(--v2-space-3);
        overflow-y: auto;
        scrollbar-width: none;
    }
    .v2-sidebar__nav::-webkit-scrollbar { display: none; }

    .v2-sidebar__item {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 11px var(--v2-space-3);
        border: none;
        background: transparent;
        border-radius: var(--v2-radius-lg);
        cursor: pointer;
        color: rgba(255, 255, 255, 0.40);
        font-family: var(--v2-font-body);
        font-size: 14px;
        font-weight: 500;
        text-align: left;
        width: 100%;
        min-height: 44px;
        transition: background 150ms ease, color 150ms ease;
    }

    .v2-sidebar__item:hover {
        background: rgba(255, 255, 255, 0.06);
        color: rgba(255, 255, 255, 0.70);
    }

    .v2-sidebar__item.active {
        color: rgba(255, 255, 255, 0.95);
        background: rgba(255, 255, 255, 0.10);
    }

    .v2-sidebar__item i {
        font-size: 17px;
        width: 20px;
        text-align: center;
        flex-shrink: 0;
    }

    /* img icons (Accueil logo) — opacity car <img> ne peut pas hériter currentColor */
    .v2-sidebar__item-img {
        width: 20px;
        height: 20px;
        flex-shrink: 0;
        opacity: 0.40;
        transition: opacity 150ms ease;
    }
    .v2-sidebar__item:hover .v2-sidebar__item-img { opacity: 0.70; }
    .v2-sidebar__item.active .v2-sidebar__item-img { opacity: 0.95; }

    /* svg icons — fill:currentColor hérite la color du parent, pas besoin d'opacity */
    .v2-sidebar__item-svg {
        width: 20px;
        height: 20px;
        flex-shrink: 0;
        fill: currentColor;
    }

    .v2-sidebar__item-label {
        white-space: nowrap;
    }

    /* ── Footer sidebar : lien site web ── */
    .v2-sidebar__footer {
        display: flex;
        flex-direction: column;
        gap: var(--v2-space-1);
        padding: var(--v2-space-3) 0;
        border-top: 1px solid rgba(255, 255, 255, 0.07);
    }

    /* Notif btn dans footer — toujours masqué (doublon topbar) */
    .v2-sidebar__notif-btn {
        display: none;
    }

    .v2-sidebar__website-link {
        display: flex;
        align-items: center;
        gap: var(--v2-space-3);
        padding: 10px var(--v2-space-3);
        border-radius: var(--v2-radius-md);
        color: rgba(255, 255, 255, 0.40);
        text-decoration: none;
        font-size: var(--v2-text-sm);
        font-weight: 500;
        transition: background 150ms ease, color 150ms ease;
    }

    .v2-sidebar__website-link:hover {
        background: rgba(255, 255, 255, 0.06);
        color: rgba(255, 255, 255, 0.70);
    }

    .v2-sidebar__website-link i {
        width: 20px;
        text-align: center;
        font-size: 16px;
        flex-shrink: 0;
    }

    /* Hide bottom nav + pregrade CTA */
    .v2-bottom-nav,
    .v2-pregrade-cta {
        display: none;
    }

    /* Main content shifts right to make room for sidebar */
    .v2-main {
        margin-left: var(--v2-sidebar-width);
        width: calc(100% - var(--v2-sidebar-width));
    }

    /* Auth view: no sidebar margin (sidebar is hidden, full-screen auth) */
    .v2-main--no-sidebar {
        margin-left: 0;
        width: 100%;
    }

    /* Views no longer need bottom padding for nav */
    .v2-view {
        padding-bottom: var(--v2-space-8);
    }

    /* Top bar adjusts for sidebar */
    .v2-top-bar {
        left: var(--v2-sidebar-width);
        padding-left: var(--v2-space-8);
        padding-right: var(--v2-space-8);
    }

    /* Top bar resets when sidebar is hidden (auth) */
    .v2-top-bar--no-sidebar {
        left: 0;
    }

    /* Toast in desktop position */
    .v2-toast-container {
        bottom: var(--v2-space-6);
        right: var(--v2-space-8);
        left: auto;
        max-width: 420px;
    }
}

/* Large desktop (1440px+): constrain content width */
@media (min-width: 1440px) {
    .v2-view {
        max-width: 1360px;
        margin-left: auto;
        margin-right: auto;
    }
}

@media (min-width: 1680px) {
    .v2-view {
        max-width: 1560px;
    }
}

@media (min-width: 1920px) {
    .v2-view {
        max-width: 1760px;
    }
}

@media (min-width: 2560px) {
    .v2-view {
        max-width: 1960px;
    }
}


/* ==========================================================================
   KEYBOARD AWARENESS (Capacitor native only)
   ========================================================================== */

/* When keyboard is open: lift toast above keyboard, hide bottom nav */
body.keyboard-open .v2-bottom-nav,
body.keyboard-open .v2-pregrade-cta {
    transform: translateY(calc(100% + 40px));
    opacity: 0;
    pointer-events: none;
    transition: transform var(--v2-duration-fast) var(--v2-ease-out-expo),
                opacity var(--v2-duration-fast) linear;
}

body.keyboard-open .v2-toast-container {
    bottom: calc(var(--v2-keyboard-height) + 16px);
}
