/* ==========================================================================
   KB Solutions — Mobile App Layer
   Loaded with  media="(max-width: 991px)"  so nothing here reaches desktop.
   Two parts:
     1. App shell — top bar, drawer, bottom tab bar (markup: layouts/mobile-shell)
     2. Content layer lives in mobile-content.css (theme pages only; the standalone
        landing pages keep their own responsive design and load just this shell).
   Prefix: kbm-
   ========================================================================== */

:root {
    --kbm-ink: #0d1f3c;
    --kbm-ink-2: #1f2937;
    --kbm-text: #374151;
    --kbm-muted: #6b7280;
    --kbm-line: #e5e9f0;
    --kbm-bg: #f5f7fa;
    --kbm-card: #ffffff;
    --kbm-accent: #29abe2;
    --kbm-accent-dark: #0a7cb8;
    --kbm-orange: #ff6b35;
    --kbm-radius: 16px;
    --kbm-radius-sm: 12px;
    --kbm-top-h: 60px;
    --kbm-tab-h: 62px;
    --kbm-safe-b: env(safe-area-inset-bottom, 0px);
    --kbm-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* Desktop safety net: the shell exists in the DOM on every page; hide it above 991px
   in case the media attribute on the <link> is ever dropped. */
@media (min-width: 992px) {
    .kbm-top, .kbm-drawer, .kbm-scrim, .kbm-tabbar { display: none !important; }
}

@media (max-width: 991px) {

/* ---------- 0. Base / document ---------- */
html { -webkit-text-size-adjust: 100%; }
body {
    -webkit-tap-highlight-color: transparent;
    overscroll-behavior-y: none;
    padding-bottom: calc(var(--kbm-tab-h) + var(--kbm-safe-b)) !important;
}
body.kbm-theme {
    background: var(--kbm-bg) !important;
    font-family: var(--kbm-font);
    -webkit-font-smoothing: antialiased;
}
body.kbm-has-top { padding-top: var(--kbm-top-h) !important; }
body.kbm-lock { overflow: hidden !important; height: 100vh; }

/* Hide the desktop header entirely on mobile — the shell replaces it */
body.kbm-has-top .header_main,
body.kbm-has-top .header_homeNew > .header_main,
body.kbm-has-top header.header { display: none !important; }
.header_homeNew { min-height: 0 !important; }
/* hidden desktop header keeps a backdrop-filter from menu-fix.css — drop it (it stalls compositing/capture on some devices) */
body.kbm-has-top .header, body.kbm-has-top .header.fixed { -webkit-backdrop-filter: none !important; backdrop-filter: none !important; }

/* ---------- 1. Top app bar ---------- */
.kbm-top {
    position: fixed; top: 0; left: 0; right: 0; z-index: 10000;
    height: var(--kbm-top-h);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 8px 0 16px;
    background: #ffffff;
    border-bottom: 1px solid transparent;
    transition: border-color .25s ease, box-shadow .25s ease, transform .3s ease;
    padding-top: env(safe-area-inset-top, 0px);
    box-sizing: content-box;
}
.kbm-top.is-scrolled { border-bottom-color: var(--kbm-line); box-shadow: 0 6px 24px -12px rgba(13, 31, 60, .25); }
.kbm-top.is-hidden { transform: translateY(-110%); }
.kbm-top-logo { display: flex; align-items: center; height: 100%; }
.kbm-top-logo img { height: 30px; width: auto; max-width: 160px; display: block; object-fit: contain; }
.kbm-top-actions { display: flex; align-items: center; gap: 4px; }
.kbm-top-cta {
    display: inline-flex; align-items: center; height: 36px; padding: 0 14px;
    border-radius: 999px; background: var(--kbm-ink); color: #fff !important;
    font: 600 13px/1 var(--kbm-font); letter-spacing: .1px; text-decoration: none !important;
    white-space: nowrap;
}
.kbm-top-cta:active { background: #000; }
.kbm-burger {
    width: 44px; height: 44px; border: 0; background: transparent; padding: 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
    border-radius: 12px; cursor: pointer;
}
.kbm-burger span { display: block; width: 22px; height: 2px; background: var(--kbm-ink); border-radius: 2px; transition: transform .25s ease, opacity .2s ease; }
.kbm-burger:active { background: #f0f3f7; }

/* ---------- 2. Drawer ---------- */
.kbm-scrim {
    position: fixed; inset: 0; z-index: 10001;
    background: rgba(13, 31, 60, .5);
    opacity: 0; transition: opacity .28s ease;
}
.kbm-scrim[hidden] { display: none; }
.kbm-scrim.is-open { opacity: 1; }

.kbm-drawer {
    position: fixed; top: 0; right: 0; bottom: 0; z-index: 10002;
    width: min(88vw, 400px);
    background: #fff;
    display: flex; flex-direction: column;
    transform: translateX(104%);
    transition: transform .34s cubic-bezier(.22, 1, .36, 1);
    box-shadow: -20px 0 60px -30px rgba(13, 31, 60, .4);
    padding-top: env(safe-area-inset-top, 0px);
    visibility: hidden;
}
.kbm-drawer.is-open { transform: translateX(0); visibility: visible; }
.kbm-drawer-head {
    flex: none; height: var(--kbm-top-h);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 8px 0 20px; border-bottom: 1px solid var(--kbm-line);
}
.kbm-drawer-logo img { height: 28px; width: auto; max-width: 150px; display: block; object-fit: contain; }
.kbm-close { width: 44px; height: 44px; border: 0; background: transparent; border-radius: 12px; display: grid; place-items: center; cursor: pointer; }
.kbm-close svg { width: 22px; height: 22px; stroke: var(--kbm-ink); stroke-width: 2; fill: none; stroke-linecap: round; }
.kbm-close:active { background: #f0f3f7; }
.kbm-drawer-body {
    flex: 1 1 auto; overflow-y: auto; -webkit-overflow-scrolling: touch;
    padding: 8px 12px calc(24px + var(--kbm-safe-b));
    overscroll-behavior: contain;
}

.kbm-item {
    display: flex; align-items: center; gap: 14px; width: 100%;
    min-height: 54px; padding: 0 10px; margin: 2px 0;
    border: 0; background: transparent; border-radius: 12px;
    font: 600 16px/1.2 var(--kbm-font); color: var(--kbm-ink) !important;
    text-decoration: none !important; text-align: left; cursor: pointer;
    -webkit-appearance: none; appearance: none;
}
.kbm-item:active, .kbm-item.is-active { background: #f2f9fd; }
.kbm-item.is-active { color: var(--kbm-accent-dark) !important; }
.kbm-item-ic { width: 36px; height: 36px; border-radius: 10px; background: #f3f5f8; display: grid; place-items: center; flex: none; }
.kbm-item-ic svg { width: 18px; height: 18px; stroke: var(--kbm-ink); stroke-width: 2; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.kbm-item.is-active .kbm-item-ic, .kbm-acc.is-open .kbm-item-ic { background: #e3f4fc; }
.kbm-item.is-active .kbm-item-ic svg, .kbm-acc.is-open .kbm-item-ic svg { stroke: var(--kbm-accent-dark); }
.kbm-item-lbl { flex: 1 1 auto; }
.kbm-acc-chev { width: 24px; height: 24px; display: grid; place-items: center; transition: transform .25s ease; }
.kbm-acc-chev svg { width: 18px; height: 18px; stroke: #9aa4b2; stroke-width: 2; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.kbm-acc.is-open .kbm-acc-chev { transform: rotate(180deg); }
.kbm-acc-panel { padding: 2px 0 10px 4px; }
.kbm-acc-panel[hidden] { display: none; }
.kbm-group { margin: 6px 0 4px; }
.kbm-group-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 10px 4px 12px;
    font: 700 11px/1 var(--kbm-font); letter-spacing: 1.2px; text-transform: uppercase; color: #94a3b8;
}
.kbm-group-head a { font: 600 12px/1 var(--kbm-font); color: var(--kbm-accent-dark) !important; text-transform: none; letter-spacing: 0; text-decoration: none !important; padding: 6px 0; }
.kbm-links { list-style: none; margin: 0; padding: 0; }
.kbm-links li { margin: 0; padding: 0; }
.kbm-links a {
    display: flex; flex-direction: column; gap: 2px;
    padding: 10px 12px; margin: 1px 0; border-radius: 10px;
    text-decoration: none !important;
}
.kbm-links a:active, .kbm-links a.is-active { background: #f2f9fd; }
.kbm-link-ttl { font: 500 14.5px/1.3 var(--kbm-font); color: var(--kbm-ink-2); }
.kbm-links a.is-active .kbm-link-ttl { color: var(--kbm-accent-dark); font-weight: 600; }
.kbm-link-desc { font: 400 12px/1.35 var(--kbm-font); color: var(--kbm-muted); }

.kbm-drawer-cta { display: flex; flex-direction: column; gap: 10px; padding: 18px 8px 8px; }
.kbm-btn {
    display: flex; align-items: center; justify-content: center; width: 100%;
    min-height: 50px; padding: 0 18px; border-radius: 14px; border: 0;
    font: 600 15px/1 var(--kbm-font); text-decoration: none !important; cursor: pointer;
    -webkit-appearance: none; appearance: none;
}
.kbm-btn-primary { background: var(--kbm-ink); color: #fff !important; }
.kbm-btn-primary:active { background: #000; }
.kbm-btn-ghost { background: #fff; color: var(--kbm-ink) !important; border: 1.5px solid var(--kbm-line); }
.kbm-btn-ghost:active { background: #f3f5f8; }
.kbm-drawer-foot { display: flex; flex-direction: column; gap: 6px; padding: 12px 8px 0; font: 400 12px/1.5 var(--kbm-font); color: var(--kbm-muted); }
.kbm-drawer-foot a { color: var(--kbm-accent-dark) !important; text-decoration: none !important; font-weight: 500; }

/* ---------- 3. Bottom tab bar ---------- */
.kbm-tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 10000;
    height: calc(var(--kbm-tab-h) + var(--kbm-safe-b));
    padding-bottom: var(--kbm-safe-b);
    display: grid; grid-template-columns: repeat(5, 1fr); align-items: stretch;
    background: #ffffff;
    border-top: 1px solid var(--kbm-line);
    box-shadow: 0 -8px 30px -18px rgba(13, 31, 60, .35);
    box-sizing: border-box;
}
.kbm-tab {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
    border: 0; background: transparent; padding: 6px 2px 4px; margin: 0;
    font: 500 10.5px/1 var(--kbm-font); letter-spacing: .2px; color: #6b7280 !important;
    text-decoration: none !important; cursor: pointer; -webkit-appearance: none; appearance: none;
    position: relative;
}
.kbm-tab svg { width: 22px; height: 22px; stroke: currentColor; stroke-width: 1.9; fill: none; stroke-linecap: round; stroke-linejoin: round; transition: transform .2s ease; }
.kbm-tab:active svg { transform: scale(.9); }
.kbm-tab.is-active { color: var(--kbm-accent-dark) !important; }
.kbm-tab.is-active::before { content: ''; position: absolute; top: 0; left: 50%; width: 28px; height: 3px; margin-left: -14px; border-radius: 0 0 3px 3px; background: var(--kbm-accent); }
.kbm-tab-cta { color: var(--kbm-ink) !important; }
.kbm-tab-cta.is-active::before { display: none; }
.kbm-tab-cta-ic {
    width: 46px; height: 46px; border-radius: 50%; margin-top: -22px;
    background: linear-gradient(135deg, var(--kbm-orange), #ff8f5e);
    display: grid; place-items: center;
    box-shadow: 0 8px 20px -6px rgba(255, 107, 53, .7), 0 0 0 5px var(--kbm-bg);
}
.kbm-tab-cta-ic svg { width: 22px; height: 22px; stroke: #fff; stroke-width: 2.4; }

} /* end @media (max-width: 991px) */

/* ---------- Small phones ---------- */
@media (max-width: 360px) {
    :root { --kbm-top-h: 56px; }
    .kbm-top-cta { display: none; }
    .kbm-tab { font-size: 10px; }
}

/* ---------- Landscape phones: slimmer bars ---------- */
@media (max-width: 991px) and (max-height: 480px) and (orientation: landscape) {
    :root { --kbm-top-h: 50px; --kbm-tab-h: 50px; }
    .kbm-tab span:not(.kbm-tab-cta-ic) { display: none; }
    .kbm-tab-cta-ic { margin-top: 0; width: 40px; height: 40px; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
    .kbm-drawer, .kbm-scrim, .kbm-top, .kbm-acc-chev, .kbm-tab svg { transition: none !important; }
}
