/*
 * OSN LabBook mobile experience
 * Loaded after page-specific styles so every workspace uses one responsive shell.
 */

.public-mobile-toggle,
.sidebar-mobile-toggle {
    display: none;
}

.pwa-install-banner {
    position: fixed;
    z-index: 250;
    right: max(1rem, env(safe-area-inset-right));
    bottom: max(1rem, env(safe-area-inset-bottom));
    display: grid;
    width: min(calc(100vw - 2rem), 34rem);
    grid-template-columns: 3.4rem minmax(0, 1fr) auto;
    gap: 1rem;
    align-items: center;
    padding: 1.05rem;
    border: 1px solid var(--osn-line-strong, #c6d6d0);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.98);
    color: var(--osn-ink, #10231f);
    box-shadow: 0 18px 55px rgba(16, 35, 31, 0.18);
    backdrop-filter: blur(18px);
}

.pwa-install-icon {
    width: 3.4rem;
    height: 3.4rem;
    border-radius: 14px;
    box-shadow: 0 8px 20px rgba(11, 117, 107, 0.2);
}

.pwa-install-copy {
    min-width: 0;
}

.pwa-install-banner > div:first-child,
.pwa-install-banner strong,
.pwa-install-banner span {
    display: block;
}

.pwa-install-banner strong {
    margin-bottom: 0.2rem;
}

.pwa-install-banner span,
.pwa-install-instructions {
    color: var(--osn-muted, #526a62);
    font-size: 0.82rem;
    line-height: 1.45;
}

.pwa-install-instructions {
    margin: 0.55rem 0 0;
    padding-top: 0.55rem;
    border-top: 1px solid var(--osn-line, #dbe5e1);
}

.pwa-install-actions {
    display: grid;
    gap: 0.45rem;
}

.pwa-install-actions .btn {
    min-width: 6.5rem;
    margin: 0;
}

.standalone-app body {
    overscroll-behavior-y: none;
}

.desktop-app body {
    background:
        radial-gradient(circle at 88% 0%, rgba(120, 205, 192, 0.14), transparent 28rem),
        var(--osn-bg, #f5f8f7);
    overflow: hidden;
}

.desktop-app .app-container {
    height: 100vh;
    min-height: 0;
    background: transparent;
}

.desktop-app .sidebar {
    width: 232px;
    padding: 1.1rem 0.85rem;
    overflow-y: auto;
    border-right: 1px solid rgba(198, 214, 208, 0.92);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(239, 247, 244, 0.98));
    box-shadow: 12px 0 36px rgba(16, 35, 31, 0.045);
}

.desktop-app .sidebar h2 {
    display: flex;
    align-items: center;
    gap: 0.72rem;
    margin-bottom: 0.55rem;
    padding: 0.3rem 0.55rem 0.65rem !important;
    border-bottom-color: rgba(255, 255, 255, 0.14) !important;
}

.desktop-app .sidebar h2::after {
    color: #f4fffc;
    content: "OSN LabBook";
    font-size: 0.9rem;
    font-weight: 820;
    letter-spacing: -0.02em;
}

.desktop-app .sidebar h2 a {
    padding: 0 !important;
    background: transparent !important;
}

.desktop-app .app-brand-logo {
    width: 2.8rem;
    height: 2.8rem;
    border-radius: 0.8rem;
    box-shadow: 0 8px 20px rgba(8, 106, 99, 0.2);
}

.app-surface-badge {
    display: inline-flex;
    width: fit-content;
    align-items: center;
    gap: 0.35rem;
    margin: 0 0 1.1rem 0.7rem;
    padding: 0.28rem 0.55rem;
    border: 1px solid #badbd3;
    border-radius: 999px;
    background: #e8f6f2;
    color: #0a675f;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.app-surface-badge::before {
    width: 0.42rem;
    height: 0.42rem;
    border-radius: 50%;
    background: #18a888;
    content: "";
    box-shadow: 0 0 0 3px rgba(24, 168, 136, 0.12);
}

.desktop-app .sidebar nav a,
.desktop-app .sidebar-more summary {
    min-height: 2.55rem;
    display: flex;
    align-items: center;
    border: 1px solid transparent;
}

.desktop-app .sidebar nav a.active {
    border-color: #c9e2dc;
    background: linear-gradient(135deg, #e4f4f0, #f3faf8);
    box-shadow: inset 3px 0 0 var(--osn-brand, #0f766e), 0 8px 18px rgba(15, 118, 110, 0.08);
}

.desktop-app .content,
.desktop-app .chat-page {
    height: 100vh;
    overflow: auto;
    padding-top: 0;
}

.desktop-app-toolbar {
    position: sticky;
    z-index: 45;
    top: 0;
    display: grid;
    min-height: 3.8rem;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 1rem;
    margin: 0 -1rem 1.15rem;
    padding: 0.55rem 1rem;
    border-bottom: 1px solid rgba(198, 214, 208, 0.9);
    background: rgba(250, 253, 252, 0.9);
    box-shadow: 0 8px 24px rgba(16, 35, 31, 0.045);
    backdrop-filter: blur(18px);
}

.desktop-app .chat-page > .desktop-app-toolbar {
    margin: 0;
}

.desktop-app-toolbar-actions,
.desktop-app-toolbar-links,
.desktop-app-toolbar-identity {
    display: flex;
    align-items: center;
}

.desktop-app-toolbar-actions {
    gap: 0.35rem;
}

.desktop-app-tool {
    display: inline-grid;
    width: 2.2rem;
    height: 2.2rem;
    place-items: center;
    padding: 0;
    border: 1px solid var(--osn-line, #dbe5e1);
    border-radius: 9px;
    background: #fff;
    color: var(--osn-ink-soft, #30483f);
    cursor: pointer;
    font: inherit;
    font-size: 1rem;
    box-shadow: 0 2px 8px rgba(16, 35, 31, 0.04);
}

.desktop-app-tool:hover {
    border-color: #9dcfc3;
    background: #eff8f6;
    color: #075f57;
}

.desktop-app-toolbar-identity {
    gap: 0.55rem;
    justify-self: center;
}

.desktop-app-mark {
    width: 2rem;
    height: 2rem;
    border-radius: 9px;
    object-fit: cover;
    box-shadow: 0 7px 16px rgba(15, 118, 110, 0.2);
}

.desktop-app-toolbar-identity div {
    display: grid;
    line-height: 1.08;
}

.desktop-app-toolbar-identity strong {
    color: var(--osn-ink, #10231f);
    font-size: 0.86rem;
}

.desktop-app-toolbar-identity small {
    color: var(--osn-muted, #63736d);
    font-size: 0.67rem;
}

.desktop-app-toolbar-links {
    justify-content: flex-end;
    gap: 0.45rem;
}

.desktop-app-toolbar-links a,
.desktop-app-status {
    min-height: 2.1rem;
    display: inline-flex;
    align-items: center;
    padding: 0.42rem 0.65rem;
    border-radius: 9px;
    font-size: 0.74rem;
    font-weight: 750;
    text-decoration: none;
}

.desktop-app-toolbar-links a {
    color: var(--osn-ink-soft, #30483f);
}

.desktop-app-toolbar-links a:hover {
    background: var(--osn-brand-soft, #e9f6f3);
    color: var(--osn-brand-strong, #0a5c56);
}

.desktop-app-status {
    gap: 0.35rem;
    border: 1px solid #c9e6d9;
    background: #ecf9f2;
    color: #176b4d;
}

.desktop-app-status::before {
    width: 0.42rem;
    height: 0.42rem;
    border-radius: 50%;
    background: #27a46f;
    content: "";
}

.desktop-app-status.is-offline {
    border-color: #ead6b1;
    background: #fff8e8;
    color: #805a13;
}

.desktop-app-status.is-offline::before {
    background: #c18420;
}

.desktop-app .pwa-install-banner {
    display: none !important;
}

.legacy-desktop-update {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 0.85rem;
    align-items: center;
    margin: 0.85rem 1rem 0;
    padding: 0.85rem 1rem;
    border: 1px solid #e5cba8;
    border-radius: 16px;
    background: #fff5e7;
    color: #23433e;
}

.legacy-update-mark {
    display: grid;
    place-items: center;
    width: 2.35rem;
    height: 2.35rem;
    border-radius: 12px;
    background: #ffe0b9;
    color: #8a5521;
    font-size: 1.2rem;
    font-weight: 850;
}

.legacy-desktop-update strong,
.legacy-desktop-update p {
    display: block;
    margin: 0;
}

.legacy-desktop-update p {
    margin-top: 0.2rem;
    color: #6e675d;
    font-size: 0.8rem;
    line-height: 1.45;
}

.legacy-update-actions {
    display: flex;
    gap: 0.45rem;
}

.legacy-update-actions .btn {
    min-height: 2.35rem;
    padding: 0.45rem 0.75rem;
    white-space: nowrap;
}

@media (max-width: 820px) {
    .legacy-desktop-update {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .legacy-update-actions {
        grid-column: 1 / -1;
        justify-content: flex-end;
    }
}

.mobile-app-dock {
    display: none;
}

.mobile-app-home,
.mobile-app-quick-actions,
.mobile-capture-sheet {
    display: none;
}

@media (display-mode: standalone), (display-mode: window-controls-overlay) {
    body {
        min-height: 100dvh;
    }

    .header,
    .sidebar {
        padding-top: max(0.55rem, env(safe-area-inset-top)) !important;
    }
}

@media (max-width: 820px), (min-width: 821px) and (max-width: 1100px) and (display-mode: standalone) {
    html {
        overflow-x: hidden;
        scroll-padding-top: 5rem;
    }

    body {
        min-width: 0;
        overflow-x: hidden;
        -webkit-text-size-adjust: 100%;
    }

    .pwa-install-banner {
        left: max(0.75rem, env(safe-area-inset-left));
        right: max(0.75rem, env(safe-area-inset-right));
        bottom: max(0.75rem, env(safe-area-inset-bottom));
        width: auto;
        grid-template-columns: 3.2rem minmax(0, 1fr);
    }

    .pwa-install-actions {
        grid-column: 1 / -1;
        grid-template-columns: 1fr 1fr;
    }

    button,
    .btn,
    input,
    select,
    textarea {
        font-size: 16px;
    }

    button,
    .btn,
    a,
    summary,
    input[type="checkbox"],
    input[type="radio"] {
        touch-action: manipulation;
    }

    .app-container {
        display: block !important;
        width: 100%;
        min-height: 100dvh;
        overflow-x: clip;
    }

    .sidebar {
        position: sticky !important;
        z-index: 80;
        top: 0;
        display: grid !important;
        width: 100% !important;
        min-width: 0 !important;
        min-height: auto !important;
        max-height: 100dvh;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
        padding: max(0.55rem, env(safe-area-inset-top)) 0.75rem 0.55rem !important;
        overflow-y: auto;
        border-right: 0 !important;
        border-bottom: 1px solid var(--osn-line, #dbe5e1) !important;
        background: rgba(255, 255, 255, 0.97) !important;
        box-shadow: 0 8px 24px rgba(16, 35, 31, 0.08);
        backdrop-filter: blur(18px);
    }

    .readonly-mode .sidebar {
        display: none !important;
    }

    .sidebar h2 {
        min-width: 0;
        margin: 0 !important;
        padding: 0 !important;
    }

    .app-brand-logo {
        width: 74px !important;
        max-height: 42px !important;
    }

    .sidebar-mobile-toggle {
        display: inline-flex;
        min-height: 2.75rem;
        max-width: min(64vw, 17rem);
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
        padding: 0.55rem 0.75rem;
        border: 1px solid var(--osn-line-strong, #c6d6d0);
        border-radius: 10px;
        background: #fff;
        color: var(--osn-ink-soft, #30483f);
        font: inherit;
        font-size: 0.82rem;
        font-weight: 750;
        line-height: 1.15;
        cursor: pointer;
    }

    .sidebar-mobile-toggle::before {
        content: "☰";
        color: var(--osn-brand, #0f766e);
        font-size: 1rem;
    }

    .sidebar.mobile-open .sidebar-mobile-toggle::before {
        content: "×";
        font-size: 1.25rem;
    }

    .sidebar-mobile-current {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .sidebar nav,
    .sidebar nav[data-compact="true"],
    .sidebar .account-panel {
        display: none !important;
    }

    .sidebar.mobile-open nav,
    .sidebar.mobile-open nav[data-compact="true"] {
        display: grid !important;
        grid-column: 1 / -1;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        width: 100%;
        gap: 0.4rem;
        margin-top: 0.65rem;
        padding: 0.65rem 0 0 !important;
        overflow: visible !important;
        border-top: 1px solid var(--osn-line, #dbe5e1);
    }

    .sidebar.mobile-open nav > a,
    .sidebar.mobile-open .sidebar-more {
        min-width: 0;
        margin: 0 !important;
    }

    .sidebar.mobile-open nav > a,
    .sidebar.mobile-open .sidebar-more summary {
        display: flex;
        min-height: 2.85rem;
        align-items: center;
        justify-content: center;
        padding: 0.62rem 0.55rem !important;
        border: 1px solid transparent;
        border-radius: 10px;
        white-space: normal !important;
        text-align: center;
    }

    .sidebar.mobile-open nav > a.active {
        border-color: #b8d8d0;
        background: var(--osn-brand-soft, #e9f6f3);
        box-shadow: none !important;
    }

    .sidebar-more {
        grid-column: 1 / -1;
        border-top: 0 !important;
        padding: 0 !important;
    }

    .sidebar-more-links {
        display: grid !important;
        width: 100% !important;
        max-width: none !important;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.35rem !important;
        padding: 0.4rem 0 0 !important;
        overflow: visible !important;
    }

    .sidebar-more-links a {
        min-width: 0;
        white-space: normal !important;
        text-align: center;
    }

    .sidebar.mobile-open .account-panel {
        display: grid !important;
        grid-column: 1 / -1;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
        gap: 0.5rem;
        margin-top: 0.55rem !important;
        padding-top: 0.55rem !important;
    }

    .sidebar .account-user {
        min-width: 0;
        margin: 0 !important;
    }

    .sidebar .account-user span,
    .sidebar .account-user strong {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .sidebar .account-actions {
        display: flex !important;
        gap: 0.35rem;
    }

    .sidebar .account-actions .btn {
        min-height: 2.55rem;
        padding: 0.5rem 0.65rem;
        font-size: 0.78rem;
        white-space: nowrap;
    }

    .content,
    .chat-page {
        width: 100% !important;
        min-width: 0 !important;
        padding-right: max(0.8rem, env(safe-area-inset-right)) !important;
        padding-bottom: max(2rem, env(safe-area-inset-bottom)) !important;
        padding-left: max(0.8rem, env(safe-area-inset-left)) !important;
    }

    .content {
        padding-top: 1rem !important;
    }

    .installed-mobile-app .content,
    .installed-mobile-app .chat-page {
        padding-bottom: calc(5.25rem + env(safe-area-inset-bottom)) !important;
    }

    .installed-mobile-app .osn-update-launcher {
        right: max(0.7rem, env(safe-area-inset-right));
        bottom: calc(5.25rem + env(safe-area-inset-bottom));
    }

    .installed-mobile-app .mobile-app-dock {
        position: fixed;
        z-index: 120;
        right: 0;
        bottom: 0;
        left: 0;
        display: grid;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        gap: 0.2rem;
        padding: 0.45rem max(0.55rem, env(safe-area-inset-right)) max(0.45rem, env(safe-area-inset-bottom)) max(0.55rem, env(safe-area-inset-left));
        border-top: 1px solid rgba(198, 214, 208, 0.95);
        background: rgba(251, 253, 252, 0.92);
        box-shadow: 0 -12px 30px rgba(16, 35, 31, 0.1);
        backdrop-filter: blur(18px);
    }

    .mobile-app-dock a,
    .mobile-app-dock button {
        display: grid;
        min-width: 0;
        min-height: 3.25rem;
        place-items: center;
        align-content: center;
        gap: 0.16rem;
        padding: 0.35rem 0.2rem;
        border-radius: 12px;
        color: var(--osn-muted, #63736d);
        font-size: 0.64rem;
        font-weight: 750;
        line-height: 1.1;
        text-align: center;
        text-decoration: none;
    }

    .mobile-app-dock button {
        border: 0;
        background: transparent;
        font-family: inherit;
        cursor: pointer;
    }

    .mobile-app-dock a.active {
        background: var(--osn-brand-soft, #e9f6f3);
        color: var(--osn-brand-strong, #0a5c56);
    }

    .mobile-app-dock .mobile-app-capture-trigger {
        position: relative;
        color: #fff;
    }

    .mobile-app-dock .mobile-app-capture-trigger::before {
        position: absolute;
        z-index: -1;
        width: 3.25rem;
        height: 3.25rem;
        border: 4px solid #fbfdfc;
        border-radius: 18px;
        background: linear-gradient(145deg, #0b756b, #12a188);
        content: "";
        box-shadow: 0 8px 22px rgba(11, 117, 107, 0.28);
        transform: translateY(-0.45rem);
    }

    .mobile-app-dock .mobile-app-capture-trigger svg {
        width: 1.45rem;
        height: 1.45rem;
        transform: translateY(-0.35rem);
    }

    .mobile-app-dock .mobile-app-capture-trigger span {
        color: var(--osn-brand-strong, #0a5c56);
        transform: translateY(-0.1rem);
    }

    .mobile-app-dock svg {
        width: 1.25rem;
        height: 1.25rem;
        fill: none;
        stroke: currentColor;
        stroke-width: 1.8;
        stroke-linecap: round;
        stroke-linejoin: round;
    }

    .installed-mobile-app .dashboard-page-header {
        display: none !important;
    }

    .installed-mobile-app .sidebar h2 {
        display: flex;
        align-items: center;
        gap: 0.58rem;
    }

    .installed-mobile-app .sidebar h2::after {
        color: #17332c;
        content: "OSN LabBook";
        font-size: 0.86rem;
        font-weight: 820;
        letter-spacing: -0.02em;
    }

    .installed-mobile-app .app-brand-logo {
        width: 2.55rem !important;
        height: 2.55rem;
        border-radius: 0.75rem;
        box-shadow: 0 6px 16px rgba(8, 106, 99, 0.2);
    }

    .installed-mobile-app .content > .mobile-app-home {
        position: relative;
        display: block;
        margin: -0.2rem 0 1rem;
        padding: 1.25rem 1.2rem 1.2rem;
        overflow: hidden;
        border: 1px solid rgba(170, 228, 215, 0.28) !important;
        border-radius: 24px !important;
        background:
            radial-gradient(circle at 88% 4%, rgba(111, 224, 200, 0.34), transparent 34%),
            linear-gradient(145deg, #08756b 0%, #075f5b 58%, #073f43 100%) !important;
        box-shadow: 0 18px 42px rgba(7, 73, 68, 0.22) !important;
    }

    .installed-mobile-app .mobile-app-home::after {
        position: absolute;
        top: -3.8rem;
        right: -3.2rem;
        width: 10rem;
        height: 10rem;
        border: 1px solid rgba(210, 250, 240, 0.16);
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.06);
        content: "";
    }

    .mobile-app-home-brand {
        position: relative;
        z-index: 1;
        display: flex;
        align-items: center;
        gap: 0.52rem;
        margin-bottom: 1.1rem;
        color: #e8fffa;
        font-size: 0.72rem;
        font-weight: 780;
        letter-spacing: 0.02em;
    }

    .mobile-app-home-brand img {
        width: 1.9rem;
        height: 1.9rem;
        border: 1px solid rgba(255, 255, 255, 0.24);
        border-radius: 0.62rem;
        box-shadow: 0 7px 18px rgba(2, 38, 36, 0.24);
    }

    .mobile-app-home-kicker {
        margin: 0 0 0.38rem;
        color: #9fe9dc;
        font-size: 0.7rem;
        font-weight: 850;
        letter-spacing: 0.1em;
        text-transform: uppercase;
    }

    .mobile-app-home h1 {
        position: relative;
        z-index: 1;
        margin: 0;
        max-width: 17rem;
        color: #fff;
        font-size: clamp(1.75rem, 9vw, 2.55rem) !important;
        letter-spacing: -0.045em;
        line-height: 1.02;
    }

    .mobile-app-home-copy {
        position: relative;
        z-index: 1;
        max-width: 31rem;
        margin: 0.7rem 0 1rem;
        color: #cce8e2;
        font-size: 0.9rem;
        line-height: 1.55;
    }

    .mobile-app-home-actions {
        position: relative;
        z-index: 1;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.55rem;
    }

    .mobile-app-home-actions .btn {
        min-height: 2.8rem;
        border-radius: 12px;
    }

    .mobile-app-home-actions .btn.primary {
        border-color: #fff !important;
        background: #fff !important;
        color: #075f58 !important;
        box-shadow: 0 8px 18px rgba(2, 38, 36, 0.18) !important;
    }

    .mobile-app-home-actions .btn.secondary {
        border-color: rgba(224, 250, 244, 0.34) !important;
        background: rgba(255, 255, 255, 0.08) !important;
        color: #f2fffc !important;
    }

    .installed-mobile-app .content > .mobile-app-quick-actions {
        display: block;
        margin: 0 0 1rem;
        padding: 0;
        border: 0 !important;
        border-radius: 0 !important;
        background: transparent !important;
        box-shadow: none !important;
    }

    .mobile-app-section-heading p {
        margin: 0 0 0.58rem;
        color: #476159;
        font-size: 0.72rem;
        font-weight: 850;
        letter-spacing: 0.08em;
        text-transform: uppercase;
    }

    .mobile-app-quick-grid {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.55rem;
    }

    .mobile-app-quick-card {
        position: relative;
        display: grid;
        min-width: 0;
        min-height: 8.1rem;
        align-content: space-between;
        gap: 0.7rem;
        padding: 0.82rem;
        border: 1px solid #d5e4df;
        border-radius: 17px;
        background: rgba(255, 255, 255, 0.92);
        color: #18312b;
        text-decoration: none;
        box-shadow: 0 8px 22px rgba(22, 55, 46, 0.055);
    }

    .mobile-app-quick-card:active {
        border-color: #95cfc2;
        background: #f5fbf9;
        transform: scale(0.985);
    }

    .mobile-app-quick-icon {
        display: grid;
        width: 2.25rem;
        height: 2.25rem;
        place-items: center;
        border-radius: 0.72rem;
        background: #e4f4f0;
        color: #087268;
    }

    .mobile-app-quick-icon svg {
        width: 1.25rem;
        height: 1.25rem;
        fill: none;
        stroke: currentColor;
        stroke-width: 1.75;
        stroke-linecap: round;
        stroke-linejoin: round;
    }

    .mobile-app-quick-card strong,
    .mobile-app-quick-card small {
        display: block;
    }

    .mobile-app-quick-card strong {
        font-size: 0.83rem;
        line-height: 1.25;
    }

    .mobile-app-quick-card small {
        margin-top: 0.2rem;
        color: #667a73;
        font-size: 0.68rem;
        line-height: 1.35;
    }

    .mobile-app-quick-arrow {
        position: absolute;
        top: 0.88rem;
        right: 0.82rem;
        color: #91a9a2;
        font-size: 1.15rem;
    }

    .installed-mobile-app .literature-feed {
        display: none;
    }

    .installed-mobile-app .stats {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
        gap: 0.45rem;
        overflow-x: auto;
    }

    .installed-mobile-app .stat {
        min-width: 0;
        padding: 0.8rem 0.45rem;
        border-color: #d8e6e2;
        border-radius: 14px;
    }

    .installed-mobile-app .stat h3 {
        margin: 0;
        color: #60756e;
        font-size: 0.66rem;
        line-height: 1.2;
    }

    .installed-mobile-app .stat p {
        margin: 0.42rem 0 0;
        color: #132d27;
        font-size: 1.05rem;
        font-weight: 800;
    }

    .installed-mobile-app .recent {
        border-color: #d8e6e2;
        border-radius: 18px;
    }

    .mobile-capture-sheet[open] {
        position: fixed;
        top: auto;
        right: 0;
        bottom: 0;
        left: 0;
        display: block;
        width: 100%;
        max-width: 42rem;
        max-height: min(82dvh, 44rem);
        margin: 0 auto;
        padding: 0.55rem max(1rem, env(safe-area-inset-right)) max(1rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
        overflow-y: auto;
        border: 0;
        border-radius: 24px 24px 0 0;
        background: #fbfdfc;
        color: #10231f;
        box-shadow: 0 -20px 65px rgba(8, 34, 29, 0.22);
    }

    .mobile-capture-sheet::backdrop {
        background: rgba(6, 26, 22, 0.48);
        backdrop-filter: blur(3px);
    }

    .mobile-capture-handle {
        width: 2.8rem;
        height: 0.3rem;
        margin: 0 auto 0.65rem;
        border-radius: 999px;
        background: #c6d7d2;
    }

    .mobile-capture-sheet header {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 1rem;
        padding: 0.25rem 0 0.9rem;
    }

    .mobile-capture-sheet header p,
    .mobile-capture-sheet header h2,
    .mobile-capture-sheet header span {
        margin: 0;
    }

    .mobile-capture-sheet header p {
        color: #0b756b;
        font-size: 0.68rem;
        font-weight: 850;
        letter-spacing: 0.1em;
        text-transform: uppercase;
    }

    .mobile-capture-sheet header h2 {
        margin-top: 0.22rem;
        font-size: 1.35rem;
    }

    .mobile-capture-sheet header span {
        display: block;
        margin-top: 0.35rem;
        color: #5b7069;
        font-size: 0.82rem;
        line-height: 1.45;
    }

    .mobile-capture-close {
        width: 2.5rem;
        height: 2.5rem;
        flex: 0 0 auto;
        border: 1px solid #d3e1dd;
        border-radius: 50%;
        background: #fff;
        color: #425b54;
        cursor: pointer;
        font-size: 1.25rem !important;
    }

    .mobile-capture-actions {
        display: grid;
        gap: 0.55rem;
    }

    .mobile-capture-action {
        display: grid;
        grid-template-columns: 2.8rem minmax(0, 1fr) auto;
        align-items: center;
        gap: 0.75rem;
        min-height: 4.5rem;
        padding: 0.65rem;
        border: 1px solid #d8e6e2;
        border-radius: 16px;
        background: #fff;
        color: #18312b;
        text-decoration: none;
    }

    .mobile-capture-action-icon {
        display: grid;
        width: 2.8rem;
        height: 2.8rem;
        place-items: center;
        border-radius: 13px;
        background: #e5f4f0;
        color: #08766b;
        font-size: 1.15rem;
        font-weight: 800;
    }

    .mobile-capture-action strong,
    .mobile-capture-action small {
        display: block;
    }

    .mobile-capture-action strong {
        font-size: 0.9rem;
    }

    .mobile-capture-action small {
        margin-top: 0.18rem;
        color: #62756f;
        font-size: 0.72rem;
        line-height: 1.35;
    }

    .mobile-capture-chevron {
        color: #78918a;
        font-size: 1.5rem;
    }

    .capture-panel-requested {
        scroll-margin-top: 5.5rem;
        border-color: #4aa795 !important;
        box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.11), 0 18px 36px rgba(15, 118, 110, 0.09);
    }

    .content > h1,
    .content header h1 {
        max-width: 100%;
        font-size: clamp(1.65rem, 8vw, 2.1rem) !important;
        line-height: 1.15;
        overflow-wrap: anywhere;
    }

    .content section,
    .content article,
    .content .card,
    .project-card,
    .log-entry,
    .protocol-card,
    .inventory-card {
        min-width: 0;
        max-width: 100%;
        overflow-wrap: anywhere;
    }

    .stats,
    .stats-grid,
    .usage-grid,
    .account-settings-grid,
    .encryption-grid,
    .intelligence-form,
    .intelligence-results-grid,
    .osn-stats,
    .packet-asset-grid,
    .form-grid,
    .analysis-grid,
    .analysis-columns,
    .materials-grid {
        grid-template-columns: 1fr !important;
    }

    .stats {
        display: grid !important;
        gap: 0.75rem;
        margin-bottom: 1rem;
    }

    .content table {
        width: 100%;
        min-width: 36rem;
    }

    .content .table-wrap,
    .content .table-scroll,
    .content section:has(> table),
    .content article:has(> table) {
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .project-tabs .tabs,
    .editor-toolbar,
    .doc-toolbar,
    .toolbar,
    .format-toolbar {
        max-width: 100%;
        flex-wrap: nowrap !important;
        overflow-x: auto;
        overscroll-behavior-x: contain;
        scrollbar-width: thin;
        -webkit-overflow-scrolling: touch;
    }

    .project-tabs .tabs > *,
    .editor-toolbar > *,
    .doc-toolbar > *,
    .toolbar > *,
    .format-toolbar > * {
        flex: 0 0 auto;
    }

    .project-detail-header,
    .project-url-tools,
    .intelligence-header,
    .osn-hero,
    .page-header,
    .materials-header,
    .analysis-header,
    .account-header,
    .settings-heading,
    .billing-account-detail,
    .billing-page-header,
    .section-heading,
    .plan-heading,
    .credit-band-heading,
    .lab-pilot-inner {
        display: grid !important;
        grid-template-columns: 1fr !important;
        align-items: stretch !important;
        gap: 0.75rem !important;
    }

    .project-url-tools .btn,
    .detail-actions .btn,
    .form-actions .btn,
    .billing-actions .btn,
    .settings-form > .btn {
        width: 100%;
    }

    .detail-list-item {
        grid-template-columns: 1fr !important;
    }

    .detail-list-item small {
        grid-column: 1 !important;
    }

    .osn-row,
    .material-usage-item,
    .ledger-row {
        align-items: stretch !important;
        flex-direction: column;
    }

    .osn-phase-path {
        grid-template-columns: 1fr !important;
    }

    .osn-phase {
        min-height: auto !important;
        border-right: 0 !important;
        border-bottom: 1px solid #e2e8f0;
    }

    .osn-phase:last-child {
        border-bottom: 0;
    }

    .notes-canvas {
        min-height: 48dvh !important;
        padding: 1rem !important;
    }

    .osn-modal-overlay {
        align-items: end;
        padding: 0;
    }

    .osn-modal {
        width: 100%;
        max-height: 88dvh;
        overflow-y: auto;
        border-radius: 18px 18px 0 0;
        padding-bottom: env(safe-area-inset-bottom);
    }

    .osn-modal-actions {
        position: sticky;
        bottom: 0;
        flex-direction: column-reverse;
        padding: 0.75rem 1rem max(1rem, env(safe-area-inset-bottom));
        background: #fff;
    }

    .osn-modal-actions .btn {
        width: 100%;
    }

    .chat-page {
        min-height: calc(100dvh - 4.3rem) !important;
        padding: 0 !important;
    }

    .chat-header {
        min-height: 0;
        padding: 0.85rem;
    }

    .chat-header,
    .chat-model-controls {
        display: grid !important;
        grid-template-columns: 1fr !important;
        align-items: stretch !important;
    }

    .chat-workspace {
        display: flex !important;
        min-height: 0;
        flex-direction: column;
    }

    .chat-workspace[hidden],
    .agent-workspace-shell[hidden] {
        display: none !important;
    }

    .workspace-mode-switch {
        width: 100%;
    }

    .conversation-panel {
        max-height: 15rem;
        border-right: 0 !important;
        border-bottom: 1px solid #dce3ec;
    }

    .chat-thread {
        min-height: 62dvh !important;
    }

    .chat-messages {
        min-height: 18rem;
        padding: 1rem 0.8rem;
    }

    .chat-message {
        max-width: 94% !important;
    }

    .chat-composer {
        position: sticky;
        z-index: 10;
        bottom: 0;
        padding: 0.75rem 0.8rem max(0.8rem, env(safe-area-inset-bottom));
    }

    .composer-footer {
        align-items: stretch;
        flex-direction: column;
        gap: 0.5rem;
    }

    .composer-footer .btn {
        width: 100%;
    }

    .context-panel {
        border-left: 0 !important;
        border-top: 1px solid #dce3ec;
    }

    .literature-header,
    .literature-controls {
        align-items: stretch !important;
    }

    .literature-controls > *,
    .literature-controls label,
    .literature-controls select,
    .literature-controls .btn {
        width: 100%;
    }

    .literature-controls .icon-control {
        width: 2.75rem;
    }

    .literature-track {
        grid-auto-columns: minmax(16rem, calc(100vw - 3.2rem)) !important;
    }
}

/* The full public navigation includes the account identity and network link.
   Collapse early so translated labels cannot collide on tablets or small laptops. */
@media (max-width: 1120px) {
    .header {
        position: sticky !important;
        top: 0;
    }

    .header .container {
        display: grid !important;
        min-height: 0;
        grid-template-columns: minmax(0, 1fr) auto auto;
        align-items: center !important;
        gap: 0.55rem;
        padding: max(0.5rem, env(safe-area-inset-top)) 0 0.5rem;
    }

    .header .logo {
        min-width: 0;
        margin: 0;
    }

    .header-brand-logo {
        width: 82px !important;
        max-height: 46px;
    }

    .public-mobile-toggle {
        display: inline-flex;
        min-height: 2.75rem;
        align-items: center;
        justify-content: center;
        gap: 0.45rem;
        padding: 0.55rem 0.75rem;
        border: 1px solid var(--osn-line-strong, #c6d6d0);
        border-radius: 10px;
        background: #fff;
        color: var(--osn-ink-soft, #30483f);
        font: inherit;
        font-size: 0.82rem;
        font-weight: 750;
        white-space: nowrap;
        cursor: pointer;
    }

    .public-mobile-toggle::before {
        content: "☰";
        color: var(--osn-brand, #0f766e);
        font-size: 1rem;
    }

    .header.mobile-open .public-mobile-toggle::before {
        content: "×";
        font-size: 1.25rem;
    }

    .navigation {
        display: none !important;
        grid-column: 1 / -1;
        width: 100%;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.35rem !important;
        padding: 0.55rem 0 0.2rem !important;
        overflow: visible !important;
        border-top: 1px solid var(--osn-line, #dbe5e1);
    }

    .header.mobile-open .navigation {
        display: grid !important;
    }

    .navigation a {
        min-width: 0;
        min-height: 2.85rem !important;
        justify-content: center;
        padding: 0.55rem 0.4rem !important;
        white-space: normal;
        text-align: center;
    }

    .public-language-switch {
        grid-column: auto;
        justify-self: end;
        margin: 0 !important;
    }

    .home-account-link {
        gap: 0.35rem;
    }

    .home-account-text {
        max-width: 7rem;
    }

    .container {
        width: min(calc(100% - 2rem), 1180px);
    }

    .hero,
    .page-hero,
    .about-hero,
    .pricing-intro {
        padding-top: 2.8rem !important;
        padding-bottom: 2.8rem !important;
    }

    .hero h2,
    html[lang="zh-CN"] .hero h2,
    .page-hero h2,
    .about-hero h2,
    .pricing-intro h2 {
        max-width: 100% !important;
        font-size: clamp(2rem, 10vw, 2.7rem) !important;
        line-height: 1.08 !important;
        letter-spacing: -0.035em !important;
        overflow-wrap: anywhere;
        word-break: normal !important;
    }

    .hero-actions {
        display: grid;
        grid-template-columns: 1fr;
    }

    .hero-actions .btn {
        width: 100%;
    }

    .preview-body {
        grid-template-columns: 1fr !important;
    }

    .preview-nav {
        display: flex !important;
        overflow-x: auto;
        border-right: 0 !important;
        border-bottom: 1px solid #e0e7e3;
        scrollbar-width: thin;
    }

    .preview-nav > * {
        flex: 0 0 auto;
    }

    .preview-timeline::before {
        display: none;
    }

    .pricing-grid,
    .pricing-grid.four-tier-grid,
    .plan-grid,
    .plan-grid.four-plans,
    .credit-pack-grid,
    .public-credit-grid,
    .payment-band-inner,
    .payment-method-list,
    .feature-list,
    .domain-grid,
    .about-hero-grid,
    .about-grid,
    .principle-grid,
    .pathway-grid {
        grid-template-columns: 1fr !important;
    }

    .plan {
        min-height: 0 !important;
    }

    .currency-selector {
        width: 100%;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }

    .payment-row {
        grid-template-columns: 2.8rem minmax(0, 1fr) !important;
    }

    .payment-row > :last-child {
        grid-column: 2;
        justify-self: start;
    }

    .auth-panel {
        min-height: calc(100dvh - 4.6rem) !important;
        padding-right: max(1rem, env(safe-area-inset-right)) !important;
        padding-bottom: max(1.5rem, env(safe-area-inset-bottom)) !important;
        padding-left: max(1rem, env(safe-area-inset-left)) !important;
    }

    .auth-card {
        padding: 1.25rem !important;
    }

    .auth-language-row {
        top: max(0.55rem, env(safe-area-inset-top)) !important;
        right: max(0.55rem, env(safe-area-inset-right)) !important;
    }

    .footer {
        padding-bottom: env(safe-area-inset-bottom);
    }
}

@media (max-width: 420px) {
    .header .container { gap: 0.35rem; }
    .header-brand-logo { width: 74px !important; }
    .public-mobile-toggle { padding-inline: 0.62rem; }

    .sidebar.mobile-open .account-panel {
        grid-template-columns: 1fr;
    }

    .sidebar .account-actions {
        width: 100%;
    }

    .sidebar .account-actions .btn {
        flex: 1 1 0;
    }

    .navigation,
    .sidebar.mobile-open nav,
    .sidebar-more-links {
        grid-template-columns: 1fr 1fr !important;
    }

    .chat-message {
        max-width: 98% !important;
    }

    .source-chip {
        max-width: calc(100vw - 4rem);
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}
