/* ═══════════════════════════════════════════════
   Brainmify — app layer (all pages), HealthTeky style.
   Loaded by templates/partials/app_head.html in base.html, base_chat.html and builder.html.
   Desktop & laptops (>=1200px): gradient top bar with the full menu.
   Phones & tablets incl. iPad landscape (<1200px): gradient app bar + slide-out menu + bottom tab bar.
   ═══════════════════════════════════════════════ */

:root {
    --brand: linear-gradient(90deg, #00a8ff 0%, #00a8ff 30%, #64dd17 100%);
    --brand-dark: linear-gradient(90deg, #0086d1 0%, #0086d1 25%, #3a9d0b 100%);
    --brand-blue: #00a8ff;
    --brand-blue-dk: #0086d1;
    --brand-green: #64dd17;
    --ink: #1b2a41;
    --ink-soft: #5f7389;
    --app-font: 'Poppins', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --nav-h: 72px;
    --app-tabbar-h: 64px;
    --app-safe-top: env(safe-area-inset-top, 0px);
    --app-safe-bottom: env(safe-area-inset-bottom, 0px);
    /* Height left for page content under the header (and above the tab bar on phones) */
    --page-h: calc(100vh - var(--nav-h));
}
@supports (height: 100dvh) { :root { --page-h: calc(100dvh - var(--nav-h)); } }
@media (max-width: 1199.98px) {
    :root { --page-h: calc(100dvh - var(--nav-h) - var(--app-safe-top) - var(--app-tabbar-h) - var(--app-safe-bottom)); }
}

/* Decorations positioned past the edge must never create sideways scrolling.
   clip (not hidden) keeps position: sticky headers working. */
html, body { overflow-x: clip; max-width: 100%; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { -webkit-tap-highlight-color: transparent; }

/* Native-feeling page changes where the browser supports it (Chrome, Edge, Safari 18+) */
@view-transition { navigation: auto; }

/* ─── Header: gradient bar, same as HealthTeky ─── */
.bm-nav {
    position: sticky;
    top: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 24px;
    width: 100%;
    height: var(--nav-h);
    padding: 0 28px;
    flex-shrink: 0;
    background: var(--brand);
    box-shadow: 0 2px 14px rgba(0, 110, 170, 0.18);
    font-family: var(--app-font);
}
.bm-nav a { text-decoration: none; }
.bm-nav-burger { display: none; }
.bm-nav-logo {
    display: flex; align-items: center; gap: 10px; flex: none;
    color: #fff !important; font-size: 1.35rem; font-weight: 700; letter-spacing: -0.3px;
}
.bm-nav-logo img { width: 36px; height: 36px; border-radius: 10px; border: 2px solid rgba(255, 255, 255, 0.9); box-shadow: 0 3px 10px rgba(0, 60, 110, 0.25); }

.bm-nav-links {
    display: flex; align-items: stretch; align-self: stretch; justify-content: center;
    gap: 0; flex: 1 1 auto; min-width: 0;
}
.bm-nav-links a {
    position: relative;
    display: flex; align-items: center; gap: 8px; flex: none;     /* never squeezed: what does not fit goes to "More" */
    padding: 0 11px;
    color: #fff !important; font-size: 15px; font-weight: 600; white-space: nowrap;
    opacity: 0.92; transition: opacity 0.15s ease;
}
.bm-nav-links a:hover { opacity: 1; }
.bm-nav-links a .nav-ico { flex: none; width: 1.1em; text-align: center; font-size: 0.9em; }
.bm-nav-links a .nav-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.bm-nav-links a.active { opacity: 1; font-weight: 700; }
.bm-nav-links a.active::after {
    content: ''; position: absolute; left: 11px; right: 11px; bottom: 0;
    height: 4px; border-radius: 4px 4px 0 0; background: #fff;
}

.bm-nav-right { display: flex; align-items: center; gap: 10px; flex: none; }
.bm-nav-signin { color: #fff !important; font-weight: 600; font-size: 14px; padding: 8px 10px; }
.bm-nav-cta {
    color: #fff !important; font-size: 13px; font-weight: 800; letter-spacing: 0.5px; text-transform: uppercase;
    padding: 9px 16px; border: 2px solid #fff; border-radius: 6px; transition: background 0.15s ease, color 0.15s ease;
}
.bm-nav-cta:hover { background: #fff; color: var(--brand-blue-dk) !important; }
.bm-nav-account { display: none; }
.bm-nav-user {
    display: flex; align-items: center; gap: 8px; padding: 4px 14px 4px 4px;
    border: 2px solid rgba(255, 255, 255, 0.85); border-radius: 999px; color: #fff !important; font-weight: 600; font-size: 14px;
}
.bm-avatar {
    display: inline-flex; align-items: center; justify-content: center; flex: none;
    width: 30px; height: 30px; border-radius: 50%;
    background: #fff; color: var(--brand-blue-dk); font-weight: 700; font-size: 14px;
}

@media (min-width: 1600px) {
    .bm-nav-links a { padding: 0 15px; }
    .bm-nav-links a.active::after { left: 15px; right: 15px; }
}
/* Below 1920px the account button is just the avatar, so every product fits in the top bar */
@media (min-width: 1200px) and (max-width: 1919.98px) {
    .bm-nav-user-name { display: none; }
    .bm-nav-user { padding: 4px; }
}
/* Laptop widths: tighten the row (links that still do not fit go into "More") */
@media (min-width: 1200px) and (max-width: 1399.98px) {
    .bm-nav { gap: 14px; padding: 0 18px; }
    .bm-nav-links a { padding: 0 9px; font-size: 14px; gap: 6px; }
    .bm-nav-links a.active::after { left: 9px; right: 9px; }
    .bm-nav-logo { font-size: 1.2rem; }
}
@media (min-width: 1200px) and (max-width: 1299.98px) {
    .bm-nav-links a .nav-ico { display: none; }
}

/* "More" at the end of the top bar: opens the mega menu (partials/mega_menu.html, app.js wireMega) */
.bm-nav-more { position: relative; display: flex; align-items: stretch; flex: none; }
.bm-nav-more[hidden], .bm-nav-links > a[hidden] { display: none !important; }
.bm-nav-more-btn {
    position: relative; display: flex; align-items: center; gap: 6px; padding: 0 11px;
    background: none; border: 0; cursor: pointer; font: inherit; font-size: 15px; font-weight: 600;
    color: #fff; opacity: 0.92; white-space: nowrap;
}
.bm-nav-more-btn:hover, .bm-nav-more-btn[aria-expanded="true"] { opacity: 1; }
.bm-nav-more-btn i { font-size: 0.7em; transition: transform 0.15s ease; }
.bm-nav-more-btn[aria-expanded="true"] i { transform: rotate(180deg); }
.bm-nav-more-btn.active { opacity: 1; font-weight: 700; }
.bm-nav-more-btn.active::after {
    content: ''; position: absolute; left: 11px; right: 11px; bottom: 0;
    height: 4px; border-radius: 4px 4px 0 0; background: #fff;
}

/* Top bar on laptops & desktops: the icon on top, the name under it - like the bottom bar */
@media (min-width: 1200px) {
    .bm-nav-links a, .bm-nav-links .bm-nav-more-btn {
        flex-direction: column; justify-content: center; gap: 4px; padding: 0 10px;
        font-size: 12.5px; font-weight: 700; line-height: 1.1; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.22);
    }
    .bm-nav-links a .nav-ico { display: block !important; width: auto; font-size: 20px; }
    .bm-nav-more-btn i { order: -1; font-size: 18px; }
    .bm-nav-links a.active::after, .bm-nav-more-btn.active::after { left: 10px; right: 10px; }
}
@media (min-width: 1400px) and (max-width: 1919.98px) {
    .bm-nav-links a, .bm-nav-links .bm-nav-more-btn { padding: 0 7px; }
    .bm-nav-links a.active::after, .bm-nav-more-btn.active::after { left: 7px; right: 7px; }
}
@media (min-width: 1200px) and (max-width: 1399.98px) {
    .bm-nav-links a, .bm-nav-links .bm-nav-more-btn { padding: 0 5px; font-size: 11.5px; }
    .bm-nav-links a.active::after, .bm-nav-more-btn.active::after { left: 5px; right: 5px; }
}
@media (min-width: 1200px) and (max-width: 1399.98px) {
    .bm-nav-more-btn { padding: 0 9px; font-size: 14px; }
    .bm-nav-more-btn.active::after { left: 9px; right: 9px; }
}

/* ─── Slide-out menu (phones & tablets), same look as HealthTeky's ─── */
.bm-menu, .bm-menu-backdrop { display: none; }

/* ─── Bottom tab bar (phones & tablets) ─── */
.app-tabbar { display: none; }

/* ─── Bottom bar (laptops & desktops), as on Socialify: the gradient, icons over labels, "More" opens the mega menu upward ─── */
.bm-dock, .bmm { display: none; }
@media (min-width: 1200px) {
    :root { --dock-h: 60px; --page-h: calc(100vh - var(--nav-h) - var(--dock-h)); }
    @supports (height: 100dvh) { :root { --page-h: calc(100dvh - var(--nav-h) - var(--dock-h)); } }
    body { padding-bottom: var(--dock-h); }
    html { scroll-padding-bottom: calc(var(--dock-h) + 12px); }
    .bm-dock {
        position: fixed; left: 0; right: 0; bottom: 0; z-index: 1000; height: var(--dock-h);
        display: flex; align-items: stretch; justify-content: center; gap: 2px; padding: 0 16px;
        background: var(--brand); box-shadow: 0 -4px 18px rgba(0, 80, 140, 0.18); font-family: var(--app-font);
    }
    .bm-dock > a, .bm-dock-more {
        position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
        min-width: 64px; padding: 0 10px; border: 0; background: none; cursor: pointer;
        color: #fff !important; font: 700 12.5px/1.1 var(--app-font); text-decoration: none !important; white-space: nowrap;
        text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25); opacity: 0.93; transition: opacity 0.15s, transform 0.15s;
    }
    .bm-dock > a i, .bm-dock-more i { font-size: 20px; filter: drop-shadow(0 1px 1.5px rgba(0, 0, 0, 0.25)); transition: transform 0.15s; }
    .bm-dock > a:hover, .bm-dock-more:hover, .bm-dock-more[aria-expanded="true"] { opacity: 1; transform: translateY(-2px); }
    .bm-dock > a.active { opacity: 1; }
    .bm-dock > a.active::before { content: ''; position: absolute; top: 0; left: 12px; right: 12px; height: 4px; border-radius: 0 0 4px 4px; background: #fff; }
    .bm-dock-more[aria-expanded="true"] i { transform: rotate(180deg); }
}
@media (min-width: 1200px) and (max-width: 1399.98px) {
    .bm-dock > a, .bm-dock-more { min-width: 0; padding: 0 7px; font-size: 11.5px; }
    .bm-dock > a i, .bm-dock-more i { font-size: 18px; }
}

/* ─── Mega menu (laptops & desktops): every part of Brainmify in four coloured columns, as on Socialify ─── */
@keyframes bmm-down { from { opacity: 0; transform: translate(-50%, -10px) scale(.98); } to { opacity: 1; transform: translate(-50%, 0) scale(1); } }
@keyframes bmm-up { from { opacity: 0; transform: translate(-50%, 10px) scale(.98); } to { opacity: 1; transform: translate(-50%, 0) scale(1); } }
@media (min-width: 1200px) {
    .bmm { position: fixed; left: 50%; z-index: 6000; width: min(1180px, calc(100vw - 32px)); border-radius: 26px; overflow: hidden;
        transform: translateX(-50%); background: #fff; box-shadow: 0 28px 70px rgba(0, 40, 80, 0.28), 0 0 0 1px rgba(0, 60, 120, 0.06);
        font-family: var(--app-font); }
    .bmm.open { display: flex; flex-direction: column; }
    .bmm.down { top: calc(var(--nav-h) + 6px); max-height: calc(100vh - var(--nav-h) - var(--dock-h) - 24px); animation: bmm-down .26s cubic-bezier(.2, .8, .2, 1); }
    .bmm.up { bottom: calc(var(--dock-h) + 6px); max-height: calc(100vh - var(--nav-h) - var(--dock-h) - 24px); flex-direction: column-reverse; animation: bmm-up .26s cubic-bezier(.2, .8, .2, 1); }
    .bmm-head { flex: none; display: flex; align-items: center; gap: 14px; padding: 18px 22px; color: #fff; background: var(--brand); text-shadow: 0 1px 2px rgba(0, 0, 0, .25); }
    .bmm-head > div { display: flex; flex-direction: column; margin-right: auto; }
    .bmm-head b { font-size: 24px; font-weight: 800; letter-spacing: -.4px; }
    .bmm-head small { font-size: 14px; font-weight: 600; opacity: .95; }
    .bmm-cta { display: inline-flex; align-items: center; height: 40px; padding: 0 18px; border-radius: 999px; background: rgba(255, 255, 255, .95);
        color: #0086d1 !important; font-weight: 700; text-decoration: none !important; text-shadow: none; box-shadow: 0 6px 16px rgba(0, 0, 0, .12); transition: transform .15s; }
    .bmm-cta:hover { transform: translateY(-1px); }
    .bmm-x { width: 40px; height: 40px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .25); color: #fff; font-size: 16px; font-weight: 800; cursor: pointer; }
    .bmm-x:hover { background: rgba(255, 255, 255, .4); }
    .bmm-body { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 6px 18px; padding: 18px 20px 20px; overflow-y: auto; min-height: 0; }
    .bmm-col { --t1: #00a8ff; --t2: #0086d1; --tint: #eaf6ff; min-width: 0; }
    .bmm-c2 { --t1: #12b886; --t2: #64dd17; --tint: #eafbf1; }
    .bmm-c3 { --t1: #7b61ff; --t2: #00a8ff; --tint: #f1efff; }
    .bmm-c4 { --t1: #ff7b25; --t2: #f4b400; --tint: #fff6e6; }
    .bmm-col h3 { display: flex; align-items: center; gap: 10px; margin: 4px 0 8px; font-size: 16px; font-weight: 800; color: #1b2a41; }
    .bmm-col h3 span { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; font-size: 18px;
        background: linear-gradient(135deg, var(--t1), var(--t2)); box-shadow: 0 6px 14px rgba(0, 0, 0, .12); }
    .bmm-col a { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 14px; color: #1b2a41 !important; text-decoration: none !important;
        transition: background .15s, transform .15s; }
    .bmm-col a:hover, .bmm-col a:focus-visible { background: var(--tint); transform: translateX(3px); outline: none; }
    .bmm-col a i { flex: none; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-style: normal; font-size: 20px;
        background: var(--tint); transition: background .15s; }
    .bmm-col a:hover i { background: linear-gradient(135deg, var(--t1), var(--t2)); }
    .bmm-col a span { display: flex; flex-direction: column; min-width: 0; }
    .bmm-col a b { font-size: 15px; font-weight: 700; line-height: 1.2; }
    .bmm-col a small { font-size: 12.5px; font-weight: 500; color: #6b7f95; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}

/* ═════════════ Phones & tablets ═════════════ */
@media (max-width: 1199.98px) {
    :root { --nav-h: 60px; }

    .bm-nav {
        height: calc(var(--nav-h) + var(--app-safe-top));
        padding: var(--app-safe-top) max(12px, env(safe-area-inset-right)) 0 max(8px, env(safe-area-inset-left));
        gap: 6px;
    }
    .bm-nav-links, .bm-nav-signin, .bm-nav-cta, .bm-nav-user-name { display: none; }
    .bm-nav-burger {
        display: inline-flex; align-items: center; justify-content: center;
        width: 44px; height: 44px; border: 0; border-radius: 12px; background: transparent;
        color: #fff; font-size: 21px; cursor: pointer;
    }
    .bm-nav-burger:active { background: rgba(255, 255, 255, 0.2); }
    .bm-nav-logo { font-size: 1.3rem; gap: 9px; }
    .bm-nav-logo img { width: 32px; height: 32px; border-radius: 9px; }
    .bm-nav-right { margin-left: auto; }
    .bm-nav-account {
        display: inline-flex; align-items: center; justify-content: center;
        width: 44px; height: 44px; color: #fff !important; font-size: 26px;
    }
    .bm-nav-user { padding: 0; border: 0; }
    .bm-nav-user .bm-avatar { width: 34px; height: 34px; }

    /* Slide-out menu */
    .bm-menu-backdrop {
        display: block; position: fixed; inset: 0; z-index: 1100;
        background: rgba(11, 37, 69, 0.38); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
        opacity: 0; pointer-events: none; transition: opacity 0.25s ease;
    }
    .bm-menu {
        display: flex; flex-direction: column;
        position: fixed; top: 0; bottom: 0; left: 0; z-index: 1101;
        width: min(84vw, 300px);
        background: linear-gradient(180deg, #eaf7ff 0%, #ffffff 30%, #ffffff 70%, #f0fbe8 100%);
        border-right: 3px solid transparent;
        border-image: linear-gradient(180deg, #00a8ff 0%, #00a8ff 30%, #64dd17 100%) 1;
        box-shadow: 8px 0 30px rgba(11, 37, 69, 0.18);
        font-family: var(--app-font);
        transform: translateX(-105%); transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1);
        overflow-y: auto; overscroll-behavior: contain;
    }
    body.bm-menu-open .bm-menu { transform: none; }
    body.bm-menu-open .bm-menu-backdrop { opacity: 1; pointer-events: auto; }
    body.bm-menu-open { overflow: hidden; }

    .bm-menu-head {
        position: sticky; top: 0; z-index: 2; flex-shrink: 0;
        display: flex; align-items: center; justify-content: space-between;
        height: calc(var(--nav-h) + var(--app-safe-top)); padding: var(--app-safe-top) 12px 0 18px;
        background: #00a8ff;
    }
    .bm-menu-logo { display: flex; align-items: center; gap: 12px; color: #fff !important; text-decoration: none; font-size: 1.4rem; font-weight: 600; }
    .bm-menu-logo img { width: 40px; height: 40px; border-radius: 11px; box-shadow: 0 4px 12px rgba(0, 60, 110, 0.25); }
    .bm-menu-close {
        display: inline-flex; align-items: center; justify-content: center;
        width: 40px; height: 40px; border: 0; border-radius: 12px; cursor: pointer;
        background: rgba(255, 255, 255, 0.22); color: #fff; font-size: 18px;
    }
    .bm-menu-close:active { background: rgba(255, 255, 255, 0.35); }

    .bm-menu-list { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; flex: 1 0 auto; }
    .bm-menu-title {
        padding: 12px 12px 6px; font-size: 0.68rem; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; color: #6f8aa6;
    }
    .bm-menu-list a, .bm-menu-install {
        display: flex; align-items: center; gap: 12px; width: 100%;
        padding: 12px 14px; border: 0; border-radius: 12px; background: none; cursor: pointer; text-align: left;
        color: #1d3b5c !important; font: 500 0.95rem/1.3 var(--app-font); text-decoration: none;
        transition: background 0.15s ease, color 0.15s ease;
    }
    .bm-menu-list a i, .bm-menu-install i { width: 22px; text-align: center; font-size: 1.05rem; color: #00a8ff; }
    .bm-menu-list a:active { background: #e6f6ff; color: #0086d1 !important; }
    .bm-menu-list a.active {
        background: var(--brand); color: #fff !important; font-weight: 600; box-shadow: 0 4px 14px rgba(0, 168, 255, 0.35);
    }
    .bm-menu-list a.active i { color: #fff; }
    .bm-menu-install[hidden] { display: none; }

    .bm-menu-foot { padding: 12px 12px calc(16px + var(--app-safe-bottom)); display: flex; flex-direction: column; gap: 8px; }
    .bm-menu-user { display: flex; align-items: center; gap: 12px; padding: 6px 6px 10px; }
    .bm-menu-user .bm-avatar { width: 40px; height: 40px; background: var(--brand); color: #fff; font-size: 16px; }
    .bm-menu-user div { min-width: 0; display: flex; flex-direction: column; font-family: var(--app-font); }
    .bm-menu-user strong { color: var(--ink); font-size: 0.95rem; }
    .bm-menu-user span:not(.bm-avatar) { color: var(--ink-soft); font-size: 0.8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .bm-menu-btn {
        display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 48px;
        border-radius: 12px; background: var(--brand-dark); color: #fff !important;
        font: 600 0.95rem var(--app-font); text-decoration: none; box-shadow: 0 6px 16px rgba(0, 134, 209, 0.3);
    }
    .bm-menu-btn-ghost { background: #fff; color: #0086d1 !important; border: 1.5px solid #cfe9fb; box-shadow: none; }

    /* Tab bar */
    .app-tabbar {
        position: fixed; left: 0; right: 0; bottom: 0; z-index: 1050;
        display: flex; overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: none;
        height: calc(var(--app-tabbar-h) + var(--app-safe-bottom));
        padding: 0 env(safe-area-inset-right) var(--app-safe-bottom) env(safe-area-inset-left);
        background: rgba(255, 255, 255, 0.92);
        -webkit-backdrop-filter: saturate(180%) blur(16px); backdrop-filter: saturate(180%) blur(16px);
        border-top: 1px solid rgba(11, 37, 69, 0.08);
        box-shadow: 0 -6px 24px rgba(11, 37, 69, 0.08);
    }
    .app-tab {
        position: relative;
        display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
        min-height: 44px; border: 0; background: none; cursor: pointer;
        color: #6b8199 !important; font: 600 11px/1.1 var(--app-font); text-decoration: none !important;
        -webkit-user-select: none; user-select: none;
    }
    .app-tabbar::-webkit-scrollbar { display: none; }
    .app-tab { flex: 1 0 68px; scroll-snap-align: start; }   /* every product; the bar scrolls sideways */
    .app-tab-menu { position: sticky; right: 0; flex: 0 0 68px; background: rgba(255, 255, 255, 0.97); box-shadow: -8px 0 14px rgba(255, 255, 255, 0.9); }
    .app-tab i { font-size: 20px; transition: transform 0.15s ease; }
    .app-tab:active i { transform: scale(0.88); }
    .app-tab.active { color: #0086d1 !important; }
    .app-tab.active i { background: var(--brand); -webkit-background-clip: text; background-clip: text; color: transparent; }
    .app-tab.active::before {
        content: ''; position: absolute; top: 0; width: 28px; height: 3px; border-radius: 0 0 3px 3px; background: var(--brand);
    }
    body.has-app-tabbar { padding-bottom: calc(var(--app-tabbar-h) + var(--app-safe-bottom)); }

    /* Content polish */
    input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]),
    select, textarea { font-size: 16px !important; }   /* stops iOS zooming into a tapped field */
    img, video, canvas, iframe { max-width: 100%; }
    img, video { height: auto; }
    h1, h2, h3 { overflow-wrap: break-word; }
    .app-table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
    .app-table-scroll > table { min-width: 100%; }
}

/* ─── Install prompt (phones only, once, not when already installed) ─── */
.app-install {
    position: fixed; left: 12px; right: 12px; z-index: 1060;
    bottom: calc(var(--app-tabbar-h) + var(--app-safe-bottom) + 12px);
    display: flex; align-items: center; gap: 12px; padding: 12px 14px;
    border-radius: 18px; background: #fff; box-shadow: 0 18px 40px rgba(11, 37, 69, 0.22);
    font-family: var(--app-font); color: #0b2545; animation: app-slide-up 0.25s ease;
}
.app-install img { width: 44px; height: 44px; border-radius: 12px; flex-shrink: 0; }
.app-install .app-install-text { flex: 1; min-width: 0; font-size: 13px; line-height: 1.35; }
.app-install .app-install-text strong { display: block; font-size: 14px; }
.app-install button { border: 0; border-radius: 12px; font: inherit; font-weight: 600; font-size: 13px; cursor: pointer; min-height: 40px; }
.app-install .app-install-go { padding: 0 16px; color: #fff; background: var(--brand-dark); }
.app-install .app-install-close { width: 36px; background: #eef4fa; color: #4a6078; }
@keyframes app-slide-up { from { transform: translateY(20px); opacity: 0; } to { transform: none; opacity: 1; } }

@media (display-mode: standalone) {
    .app-install { display: none !important; }
    .bm-nav, .app-tabbar, .bm-menu { -webkit-user-select: none; user-select: none; }
}

/* ─── Scrolling ticker strip (home page): full width, brand gradient ─── */
.bm-ticker {
    position: relative; flex-shrink: 0; width: 100%; overflow: hidden;
    background: var(--brand); font-family: var(--app-font);
}
.bm-ticker-track { display: flex; width: max-content; animation: bm-ticker 90s linear infinite; }
.bm-ticker:hover .bm-ticker-track { animation-play-state: paused; }
.bm-ticker-item {
    display: flex; align-items: center; gap: 8px; flex-shrink: 0;
    padding: 10px 0; color: #fff; font-size: 0.92rem; font-weight: 700; white-space: nowrap;
}
.bm-ticker-item::after { content: '|'; margin: 0 16px; opacity: 0.75; font-weight: 400; }
@keyframes bm-ticker { to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) { .bm-ticker-track { animation-duration: 400s; } }

/* ─── Signed-in corner: the name pill opens Account settings (/account/); Sign out is its own round button ─── */
.bm-nav-right { display: flex; align-items: center; gap: 10px; }
.bm-nav-user { transition: background 0.15s ease, color 0.15s ease; }
.bm-nav-user:hover { background: rgba(255, 255, 255, 0.18); }
.bm-nav-user-gear { font-size: 13px; opacity: 0.85; margin-left: 2px; transition: transform 0.3s ease; }
.bm-nav-user:hover .bm-nav-user-gear { transform: rotate(60deg); opacity: 1; }
.bm-nav-logout {
    display: inline-flex; align-items: center; justify-content: center; flex: none; width: 40px; height: 40px;
    border: 2px solid rgba(255, 255, 255, 0.85); border-radius: 50%; color: #fff !important; font-size: 15px;
    transition: background 0.15s ease, color 0.15s ease;
}
.bm-nav-logout:hover { background: #fff; color: var(--brand-blue-dk) !important; }
/* the 🔔 for notifications from every app (notify/), with the unread count */
.bm-nav-bell {
    position: relative; display: inline-flex; align-items: center; justify-content: center; flex: none; width: 40px; height: 40px;
    border-radius: 50%; color: #fff !important; font-size: 18px; text-decoration: none !important; transition: background 0.15s ease;
}
.bm-nav-bell:hover { background: rgba(255, 255, 255, 0.18); }
.bm-nav-bell b {
    position: absolute; top: 2px; right: 0; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: #ff3b30;
    color: #fff; font: 700 11px/18px var(--app-font, sans-serif); text-align: center; box-shadow: 0 0 0 2px rgba(0, 120, 200, 0.5);
}
@media (max-width: 1199.98px) { .bm-nav-bell { width: 36px; height: 36px; font-size: 17px; } }
@media (min-width: 1200px) and (max-width: 1399.98px) { .bm-nav-user-gear { display: none; } }
@media (min-width: 1200px) and (max-width: 1299.98px) { .bm-nav-logout { width: 34px; height: 34px; font-size: 13px; } }
@media (max-width: 1199.98px) {
    .bm-nav-logout, .bm-nav-user-gear { display: none; }            /* phones & tablets: Sign out lives in the slide-out menu */
    a.bm-menu-user { text-decoration: none; border-radius: 14px; padding: 8px; margin: -2px -2px 2px; transition: background 0.15s ease; }
    a.bm-menu-user:hover, a.bm-menu-user:active { background: #eef7ff; }
    .bm-menu-user div { flex: 1; }
    .bm-menu-user-go { color: #9db0c4; font-size: 13px; }
}

/* Phones & tablets: the Brainmify title sits in the centre of the bar (menu button left, account right) */
@media (max-width: 1199.98px) {
    .bm-nav-logo {
        position: absolute; left: 50%; top: var(--app-safe-top); height: var(--nav-h);
        transform: translateX(-50%); display: flex; align-items: center; white-space: nowrap;
        width: max-content;            /* a box anchored at 50% would otherwise be capped at half the bar's width */
    }
}

/* Phones & tablets: the centred title's size is set by app.js (wireTitleFit); the icon scales with it */
@media (max-width: 1199.98px) {
    .bm-nav-logo { font-size: 22px; gap: 0.4em; }
    .bm-nav-logo img { width: 1.5em; height: 1.5em; border-radius: 0.38em; }
}
