/**
 * sg_pwa.css — Enterprise PWA 3.0 & Multi-Device Experience (Desktop · Tablet · Mobile)
 * CRE Group · Sistema de Gestión Enterprise
 */

/* ═══════════════════════════════════════════════════════════════════════════
   1. STANDALONE WINDOW MODE ENHANCEMENTS (Desktop, Tablet & Mobile)
   ═══════════════════════════════════════════════════════════════════════════ */
.sg-standalone-only {
    display: none !important;
}

@media (display-mode: standalone), (display-mode: window-controls-overlay), (display-mode: minimal-ui) {
    .sg-standalone-only {
        display: inline-flex !important;
    }
    .sg-browser-only {
        display: none !important;
    }
}

body.sg-is-standalone .sg-standalone-only {
    display: inline-flex !important;
}
body.sg-is-standalone .sg-browser-only {
    display: none !important;
}

/* Desktop Standalone Back / Forward / Reload Mini-Controls in Topbar */
.sg-standalone-nav {
    display: none;
    align-items: center;
    gap: 4px;
    padding: 3px;
    border-radius: 11px;
    background: rgba(15, 23, 42, 0.045);
    border: 1px solid rgba(203, 213, 225, 0.75);
    margin-right: 6px;
    flex-shrink: 0;
}
body.dark-mode .sg-standalone-nav {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(148, 163, 184, 0.2);
}
@media (min-width: 768px) {
    body.sg-is-standalone .sg-standalone-nav {
        display: inline-flex;
    }
}
@media (min-width: 768px) and (display-mode: standalone) {
    .sg-standalone-nav {
        display: inline-flex;
    }
}

.sg-standalone-nav-btn {
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #475569;
    font-size: 0.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.16s ease, color 0.16s ease;
}
.sg-standalone-nav-btn:hover {
    background: #ffffff;
    color: #1d4ed8;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.08);
}
body.dark-mode .sg-standalone-nav-btn {
    color: #cbd5e1;
}
body.dark-mode .sg-standalone-nav-btn:hover {
    background: rgba(59, 130, 246, 0.22);
    color: #ffffff;
}

/* Sidebar PWA Card (Expanded + Collapsed Capsule Rail compatible) */
.sg-sb-pwa-wrap {
    padding: 8px 12px 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
    position: relative;
    z-index: 2;
}
.sg-sb-pwa-btn {
    width: 100%;
    padding: 9px 12px;
    border-radius: 13px;
    border: 1px solid rgba(96, 165, 250, 0.36);
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.92) 0%, rgba(29, 78, 216, 0.96) 100%);
    color: #ffffff;
    font-size: 0.78rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    white-space: nowrap;
    box-shadow: 0 6px 18px rgba(37, 99, 235, 0.28);
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}
.sg-sb-pwa-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 24px rgba(37, 99, 235, 0.42);
}
.sg-sb-pwa-btn.is-installed {
    background: rgba(16, 185, 129, 0.16);
    border-color: rgba(52, 211, 153, 0.38);
    color: #a7f3d0;
    box-shadow: none;
}
.sg-sb-pwa-btn.is-installed:hover {
    background: rgba(16, 185, 129, 0.26);
    color: #ffffff;
}
body.sidebar-collapsed #sidebar .sg-sb-pwa-wrap {
    padding: 8px 10px;
}
body.sidebar-collapsed #sidebar .sg-sb-pwa-btn {
    padding: 10px 0;
    border-radius: 14px;
}
body.sidebar-collapsed #sidebar .sg-sb-pwa-btn .sg-sb-pwa-label {
    display: none !important;
}

/* Topbar Install / App Status Trigger */
.sg-topbar-pwa-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 34px;
    padding: 0 12px;
    border-radius: 11px;
    border: 1px solid rgba(37, 99, 235, 0.24);
    background: rgba(37, 99, 235, 0.08);
    color: #1d4ed8;
    font-size: 0.76rem;
    font-weight: 700;
    white-space: nowrap;
    flex-shrink: 0;
    cursor: pointer;
    transition: all 0.18s ease;
}
.sg-topbar-pwa-btn:hover {
    background: #2563eb;
    border-color: #2563eb;
    color: #ffffff;
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.25);
}
.sg-topbar-pwa-btn.is-installed {
    border-color: rgba(16, 185, 129, 0.3);
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
}
.sg-topbar-pwa-btn.is-installed:hover {
    background: #059669;
    border-color: #059669;
    color: #ffffff;
}
body.dark-mode .sg-topbar-pwa-btn {
    background: rgba(59, 130, 246, 0.16);
    border-color: rgba(96, 165, 250, 0.32);
    color: #93c5fd;
}
body.dark-mode .sg-topbar-pwa-btn:hover {
    background: #2563eb;
    color: #ffffff;
}
body.dark-mode .sg-topbar-pwa-btn.is-installed {
    background: rgba(16, 185, 129, 0.16);
    border-color: rgba(52, 211, 153, 0.35);
    color: #6ee7b7;
}

/* ═══════════════════════════════════════════════════════════════════════════
   2. ENTERPRISE PWA INSTALLATION & DIAGNOSTICS STUDIO MODAL
   ═══════════════════════════════════════════════════════════════════════════ */
.sg-pwa-backdrop {
    position: fixed;
    inset: 0;
    z-index: 10090;
    background: rgba(7, 13, 30, 0.62);
    backdrop-filter: blur(7px);
    -webkit-backdrop-filter: blur(7px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    animation: sgPwaFadeIn 0.2s ease-out;
}
.sg-pwa-backdrop.open {
    display: flex;
}
@keyframes sgPwaFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.sg-pwa-modal {
    width: 100%;
    max-width: 820px;
    max-height: calc(100vh - 32px);
    max-height: calc(100dvh - 32px);
    background: #ffffff;
    color: #0f172a;
    border-radius: 22px;
    border: 1px solid rgba(203, 213, 225, 0.9);
    box-shadow: 0 32px 80px rgba(7, 13, 30, 0.42);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: sgPwaSlideUp 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}
body.dark-mode .sg-pwa-modal {
    background: #13203d;
    color: #f8fafc;
    border-color: rgba(148, 163, 184, 0.24);
}
@keyframes sgPwaSlideUp {
    from { opacity: 0; transform: translateY(14px) scale(0.985); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.sg-pwa-head {
    background: linear-gradient(135deg, #0b132b 0%, #152857 56%, #1e3a8a 100%);
    border-bottom: 2.5px solid #eab308;
    padding: 20px 24px;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-shrink: 0;
}
.sg-pwa-head-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}
.sg-pwa-head-icon {
    width: 52px;
    height: 52px;
    border-radius: 15px;
    background: #ffffff;
    border: 2px solid rgba(234, 179, 8, 0.7);
    padding: 6px;
    object-fit: contain;
    flex-shrink: 0;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.28);
}
.sg-pwa-kicker {
    font-size: 0.66rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #fde047;
    margin-bottom: 2px;
}
.sg-pwa-title {
    font-size: 1.12rem;
    font-weight: 800;
    margin: 0;
    line-height: 1.25;
    color: #ffffff;
}
.sg-pwa-sub {
    font-size: 0.78rem;
    color: rgba(226, 232, 240, 0.88);
    margin-top: 2px;
}
.sg-pwa-close {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.16s ease;
}
.sg-pwa-close:hover {
    background: rgba(255, 255, 255, 0.22);
}

.sg-pwa-body {
    padding: 20px 24px;
    overflow-y: auto;
    flex: 1 1 auto;
    min-height: 0;
}

/* Native 1-Click Install Callout */
.sg-pwa-direct-box {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border: 1.5px solid #93c5fd;
    border-radius: 16px;
    padding: 16px 18px;
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 14px;
}
body.dark-mode .sg-pwa-direct-box {
    background: linear-gradient(135deg, rgba(30, 58, 138, 0.42), rgba(23, 37, 84, 0.65));
    border-color: rgba(96, 165, 250, 0.42);
}
.sg-pwa-direct-box.installed {
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    border-color: #6ee7b7;
}
body.dark-mode .sg-pwa-direct-box.installed {
    background: linear-gradient(135deg, rgba(6, 95, 70, 0.35), rgba(6, 78, 59, 0.5));
    border-color: rgba(52, 211, 153, 0.42);
}
.sg-pwa-direct-cta {
    padding: 11px 20px;
    border-radius: 12px;
    border: 0;
    background: linear-gradient(135deg, #1e3a8a, #2563eb);
    color: #ffffff;
    font-size: 0.85rem;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    flex-shrink: 0;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.32);
    transition: transform 0.16s ease, filter 0.16s ease;
}
.sg-pwa-direct-cta:hover {
    transform: translateY(-1px);
    filter: brightness(1.06);
}

/* Device Switcher Tabs (Escritorio | Tablet | Móvil) */
.sg-pwa-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 18px;
}
@media (max-width: 575.98px) {
    .sg-pwa-head {
        padding: 15px 16px;
    }
    .sg-pwa-body {
        padding: 14px 16px;
    }
    .sg-pwa-tabs {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 6px;
        margin-bottom: 14px;
    }
    .sg-pwa-tab {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 9px 6px;
        gap: 5px;
    }
    .sg-pwa-tab .text-muted {
        display: none;
    }
    .sg-pwa-tab-badge {
        margin-left: 0;
    }
    .sg-pwa-foot {
        padding: 10px 14px;
        gap: 6px;
    }
    .sg-pwa-btn-sec {
        padding: 7px 10px;
        font-size: 0.73rem;
    }
}
.sg-pwa-tab {
    padding: 12px 14px;
    border-radius: 14px;
    border: 1.5px solid #e2e8f0;
    background: #f8fafc;
    color: #334155;
    cursor: pointer;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 11px;
    transition: all 0.18s ease;
}
.sg-pwa-tab:hover {
    border-color: #93c5fd;
    background: #ffffff;
}
.sg-pwa-tab.active {
    border-color: #2563eb;
    background: #eff6ff;
    color: #0f172a;
    box-shadow: 0 6px 18px rgba(37, 99, 235, 0.12);
}
body.dark-mode .sg-pwa-tab {
    background: #0f1b36;
    border-color: rgba(148, 163, 184, 0.22);
    color: #cbd5e1;
}
body.dark-mode .sg-pwa-tab.active {
    background: rgba(37, 99, 235, 0.24);
    border-color: #60a5fa;
    color: #ffffff;
}
.sg-pwa-tab-ico {
    width: 38px;
    height: 38px;
    border-radius: 11px;
    background: rgba(37, 99, 235, 0.12);
    color: #2563eb;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}
.sg-pwa-tab.active .sg-pwa-tab-ico {
    background: #2563eb;
    color: #ffffff;
}
.sg-pwa-tab-badge {
    font-size: 0.6rem;
    font-weight: 800;
    padding: 2px 7px;
    border-radius: 999px;
    background: rgba(16, 185, 129, 0.15);
    color: #059669;
    margin-left: auto;
    white-space: nowrap;
    flex-shrink: 0;
}
body.dark-mode .sg-pwa-tab-badge {
    background: rgba(16, 185, 129, 0.24);
    color: #6ee7b7;
}

.sg-pwa-pane {
    display: none;
}
.sg-pwa-pane.active {
    display: block;
    animation: sgPwaFadeIn 0.2s ease;
}

/* Benefits & Step-by-Step Cards */
.sg-pwa-benefits {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}
@media (max-width: 640px) {
    .sg-pwa-benefits {
        grid-template-columns: 1fr;
    }
}
.sg-pwa-benefit {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 11px 13px;
    border-radius: 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    font-size: 0.8rem;
    line-height: 1.4;
}
body.dark-mode .sg-pwa-benefit {
    background: #0f1b36;
    border-color: rgba(148, 163, 184, 0.18);
}
.sg-pwa-benefit i {
    color: #2563eb;
    margin-top: 2px;
    flex-shrink: 0;
}
body.dark-mode .sg-pwa-benefit i {
    color: #60a5fa;
}

.sg-pwa-steps-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}
@media (max-width: 720px) {
    .sg-pwa-steps-grid {
        grid-template-columns: 1fr;
    }
}
.sg-pwa-step-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 14px 15px;
    position: relative;
}
body.dark-mode .sg-pwa-step-card {
    background: #17274a;
    border-color: rgba(148, 163, 184, 0.22);
}
.sg-pwa-step-num {
    width: 26px;
    height: 26px;
    border-radius: 8px;
    background: linear-gradient(135deg, #0b132b, #2563eb);
    color: #ffffff;
    font-size: 0.74rem;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
}
.sg-pwa-step-title {
    font-size: 0.83rem;
    font-weight: 700;
    margin-bottom: 4px;
}
.sg-pwa-step-desc {
    font-size: 0.76rem;
    color: #64748b;
    line-height: 1.42;
}
body.dark-mode .sg-pwa-step-desc {
    color: #cbd5e1;
}

/* QR Mobile Handoff Box inside Desktop Tab */
.sg-pwa-qr-card {
    margin-top: 16px;
    padding: 14px 16px;
    border-radius: 16px;
    background: linear-gradient(135deg, #f8fafc 0%, #eff6ff 100%);
    border: 1px solid #cbd5e1;
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}
body.dark-mode .sg-pwa-qr-card {
    background: #0f1b36;
    border-color: rgba(148, 163, 184, 0.24);
}
.sg-pwa-qr-svg {
    width: 108px;
    height: 108px;
    background: #ffffff;
    border-radius: 12px;
    padding: 6px;
    border: 1px solid #cbd5e1;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.sg-pwa-qr-svg svg {
    width: 100%;
    height: 100%;
    display: block;
}

/* Diagnostics Strip & Modal Footer */
.sg-pwa-diag-strip {
    margin-top: 18px;
    padding: 12px 14px;
    border-radius: 14px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}
@media (max-width: 720px) {
    .sg-pwa-diag-strip {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
body.dark-mode .sg-pwa-diag-strip {
    background: #0d1830;
    border-color: rgba(148, 163, 184, 0.2);
}
.sg-pwa-diag-item {
    min-width: 0;
}
.sg-pwa-diag-lbl {
    font-size: 0.66rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
}
body.dark-mode .sg-pwa-diag-lbl {
    color: #94a3b8;
}
.sg-pwa-diag-val {
    font-size: 0.78rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sg-pwa-foot {
    padding: 14px 24px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    flex-shrink: 0;
}
body.dark-mode .sg-pwa-foot {
    background: #0f1b36;
    border-top-color: rgba(148, 163, 184, 0.2);
}
.sg-pwa-btn-sec {
    padding: 8px 14px;
    border-radius: 10px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #334155;
    font-size: 0.78rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.16s ease;
}
.sg-pwa-btn-sec:hover {
    border-color: #2563eb;
    color: #1d4ed8;
}
body.dark-mode .sg-pwa-btn-sec {
    background: #17274a;
    border-color: rgba(148, 163, 184, 0.26);
    color: #e2e8f0;
}
body.dark-mode .sg-pwa-btn-sec:hover {
    border-color: #60a5fa;
    color: #ffffff;
}

/* ═══════════════════════════════════════════════════════════════════════════
   3. SMART FLOATING INSTALL BANNER & LIVE NETWORK STATUS PILL
   ═══════════════════════════════════════════════════════════════════════════ */
.sg-pwa-smart-banner {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 1038;
    width: 390px;
    max-width: calc(100vw - 24px);
    background: rgba(15, 23, 42, 0.96);
    color: #ffffff;
    border: 1px solid rgba(234, 179, 8, 0.45);
    border-radius: 18px;
    padding: 13px 15px;
    box-shadow: 0 20px 48px rgba(7, 13, 30, 0.42);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    display: none;
    align-items: center;
    gap: 12px;
    animation: sgPwaSlideUp 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}
.sg-pwa-smart-banner.visible {
    display: flex;
}
@media (max-width: 767.98px) {
    .sg-pwa-smart-banner {
        left: 12px;
        right: 12px;
        width: auto;
        bottom: calc(78px + env(safe-area-inset-bottom, 0px));
    }
    body:not(.sg-has-mobile-dock) .sg-pwa-smart-banner {
        bottom: calc(14px + env(safe-area-inset-bottom, 0px));
    }
}
.sg-pwa-banner-ico {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: #ffffff;
    padding: 4px;
    object-fit: contain;
    flex-shrink: 0;
}
.sg-pwa-banner-text {
    flex: 1 1 auto;
    min-width: 0;
}
.sg-pwa-banner-title {
    font-size: 0.82rem;
    font-weight: 800;
    color: #f8fafc;
    line-height: 1.25;
}
.sg-pwa-banner-sub {
    font-size: 0.71rem;
    color: #cbd5e1;
    line-height: 1.3;
    margin-top: 2px;
}
.sg-pwa-banner-btn {
    padding: 7px 13px;
    border-radius: 10px;
    border: 0;
    background: linear-gradient(135deg, #eab308, #f59e0b);
    color: #0b132b;
    font-size: 0.75rem;
    font-weight: 800;
    white-space: nowrap;
    flex-shrink: 0;
    cursor: pointer;
}
.sg-pwa-banner-close {
    width: 26px;
    height: 26px;
    border: 0;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    color: #cbd5e1;
    font-size: 0.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    cursor: pointer;
}

/* Live Network Connection Pill */
.sg-pwa-net-pill {
    position: fixed;
    top: max(14px, env(safe-area-inset-top, 14px));
    left: 50%;
    transform: translateX(-50%) translateY(-80px);
    z-index: 10099;
    padding: 8px 16px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    color: #ffffff;
    background: #dc2626;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.35);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.24s ease, background 0.2s ease;
}
.sg-pwa-net-pill.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}
.sg-pwa-net-pill.online {
    background: #059669;
}

/* ═══════════════════════════════════════════════════════════════════════════
   4. TABLET (768px – 1199px) & MOBILE (< 768px) NATIVE ERGONOMICS
   ═══════════════════════════════════════════════════════════════════════════ */

/* Tablet Hybrid Touch Ergonomics */
@media (min-width: 769px) and (max-width: 1199.98px) {
    #sidebar .nav-link {
        min-height: 42px;
    }
    .sg-topbar {
        padding-left: 12px !important;
        padding-right: 12px !important;
    }
}

/* Mobile Bottom Navigation Dock (< 768px) */
.sg-mobile-bottom-dock {
    display: none;
}

@media (max-width: 767.98px) {
    body.sg-has-mobile-dock .sg-content {
        padding-bottom: calc(82px + env(safe-area-inset-bottom, 0px)) !important;
    }

    /* Lift floating chat trigger slightly above the mobile bottom dock */
    body.sg-has-mobile-dock #sgChatFab,
    body.sg-has-mobile-dock .sg-chat-fab {
        bottom: calc(78px + env(safe-area-inset-bottom, 0px)) !important;
    }

    .sg-mobile-bottom-dock {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 1035;
        background: rgba(255, 255, 255, 0.96);
        border-top: 1px solid rgba(203, 213, 225, 0.9);
        backdrop-filter: blur(18px);
        -webkit-backdrop-filter: blur(18px);
        padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px));
        box-shadow: 0 -8px 28px rgba(15, 23, 42, 0.08);
        display: grid;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        gap: 4px;
        transition: transform 0.22s ease;
    }
    body.dark-mode .sg-mobile-bottom-dock {
        background: rgba(15, 23, 42, 0.96);
        border-top-color: rgba(148, 163, 184, 0.2);
        box-shadow: 0 -10px 30px rgba(2, 6, 23, 0.45);
    }

    /* Hide dock cleanly when keyboard is open or a modal/drawer is open */
    body.sg-kb-open .sg-mobile-bottom-dock,
    body.modal-open .sg-mobile-bottom-dock,
    body.sidebar-mobile-open .sg-mobile-bottom-dock {
        transform: translateY(110%);
    }

    .sg-mdock-item {
        border: 0;
        background: transparent;
        text-decoration: none !important;
        color: #64748b;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        padding: 5px 4px;
        border-radius: 12px;
        font-size: 0.64rem;
        font-weight: 700;
        position: relative;
        min-width: 0;
        cursor: pointer;
        transition: color 0.16s ease, background 0.16s ease;
    }
    .sg-mdock-item i {
        font-size: 1.02rem;
        line-height: 1.1;
    }
    .sg-mdock-item span {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%;
    }
    .sg-mdock-item.active {
        color: #1d4ed8;
        background: rgba(37, 99, 235, 0.09);
    }
    body.dark-mode .sg-mdock-item {
        color: #94a3b8;
    }
    body.dark-mode .sg-mdock-item.active {
        color: #60a5fa;
        background: rgba(59, 130, 246, 0.18);
    }
    .sg-mdock-badge {
        position: absolute;
        top: 2px;
        right: calc(50% - 18px);
        min-width: 16px;
        height: 16px;
        padding: 0 4px;
        border-radius: 999px;
        background: #ef4444;
        color: #ffffff;
        font-size: 0.56rem;
        font-weight: 800;
        display: none;
        align-items: center;
        justify-content: center;
        line-height: 1;
    }
    .sg-mdock-badge.show {
        display: inline-flex;
    }
}

@media print {
    .sg-pwa-smart-banner,
    .sg-pwa-backdrop,
    .sg-pwa-net-pill,
    .sg-mobile-bottom-dock,
    .sg-standalone-nav,
    .sg-topbar-pwa-btn,
    .sg-sb-pwa-wrap {
        display: none !important;
    }
}
