/* OSN LabBook — Soft Research visual system (selected direction 1). */

@font-face {
    font-family: "OSN Plex";
    src: url("../vendor/fonts/IBMPlexSans-Variable.woff2") format("woff2");
    font-style: normal;
    font-weight: 100 700;
    font-display: swap;
}

@font-face {
    font-family: "OSN Nunito";
    src: url("../vendor/fonts/Nunito-Variable.woff2") format("woff2");
    font-style: normal;
    font-weight: 200 1000;
    font-display: swap;
}

:root {
    color-scheme: light;
    --osn-font: "OSN Plex", "Noto Sans SC", "PingFang SC", "Microsoft YaHei UI", sans-serif;
    --osn-font-display: "OSN Nunito", "OSN Plex", "Noto Sans SC", "PingFang SC", "Microsoft YaHei UI", sans-serif;
    --osn-ink: #163631;
    --osn-ink-soft: #39564f;
    --osn-muted: #71817b;
    --osn-brand: #087c72;
    --osn-brand-strong: #05645d;
    --osn-brand-deep: #075b55;
    --osn-brand-soft: #e7f5f1;
    --osn-blue: #5ba9bd;
    --osn-bg: #f8f7f2;
    --osn-surface: #fffefa;
    --osn-line: #dce7e2;
    --osn-line-strong: #c8d9d2;
    --osn-sky: #e1f2f6;
    --osn-peach: #ffead2;
    --osn-lilac: #eeeafb;
    --osn-danger-soft: #fff0ec;
    --osn-radius-xs: 8px;
    --osn-radius-sm: 12px;
    --osn-radius: 18px;
    --osn-radius-lg: 26px;
    --osn-shadow-sm: 0 1px 2px rgba(15, 74, 66, .035), 0 10px 28px rgba(15, 74, 66, .055);
    --osn-shadow: 0 22px 60px rgba(15, 74, 66, .10);
}

html,
html[lang="zh-CN"] body,
body,
button,
input,
select,
textarea { font-family: var(--osn-font) !important; }

html, body {
    max-width: 100%;
    overflow-x: clip;
    background: var(--osn-bg);
}
body { color: var(--osn-ink); line-height: 1.62; }

/* Layout resilience: flex/grid children and long scientific identifiers must
   shrink inside their surface instead of forcing page-level overflow. */
:where(main, .container, .app-container, .content, .content > *, fieldset) { min-width: 0; }
:where(.content, .auth-card, .osn-modal) :where(h1, h2, h3, p, label) {
    overflow-wrap: anywhere;
}
:where(.content, .auth-card, .osn-modal) :where(img, video, iframe) { max-width: 100%; }
:where(.content, .auth-card, .osn-modal) :where(pre, code) { max-width: 100%; }
.content pre { overflow-x: auto; }

h1, h2, h3,
.hero h2,
.page-hero h2,
.auth-story h1,
.auth-card header h1,
.auth-card header h2,
.osn-modal-title,
.dashboard-page-header h1 {
    font-family: var(--osn-font-display) !important;
    font-weight: 700;
    letter-spacing: -.035em;
}

::selection { background: #c3e4ec; color: var(--osn-ink); }

/* Public navigation */
.header {
    border-bottom: 1px solid rgba(200, 217, 210, .8) !important;
    background: rgba(255, 254, 250, .94) !important;
    box-shadow: 0 8px 30px rgba(19, 72, 64, .04) !important;
}
.header .container { width: min(calc(100% - 3rem), 1320px); }
.navigation { gap: .12rem; flex-wrap: nowrap; }
.navigation a { padding-right: .68rem; padding-left: .68rem; font-size: .86rem; }
.navigation a { border-radius: 999px !important; }
.navigation a:hover,
.navigation a[aria-current="page"] { background: var(--osn-brand-soft) !important; }

/* Keep the cross-product bridge visually distinct from LabBook sections. */
.navigation a.osn-network-link {
    gap: .42rem;
    border: 1px solid #b8d8d0;
    background: linear-gradient(135deg, #f3fbf8 0%, #edf7fb 100%) !important;
    color: var(--osn-brand-deep) !important;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .72);
    white-space: nowrap;
}
.navigation a.osn-network-link::before {
    width: .48rem;
    height: .48rem;
    flex: 0 0 auto;
    border: 2px solid var(--osn-brand);
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(8, 124, 114, .10);
    content: "";
}
.navigation a.osn-network-link::after {
    content: "↗";
    color: var(--osn-brand);
    font-family: var(--osn-font);
    font-size: .78rem;
    font-weight: 800;
    line-height: 1;
}
.navigation a.osn-network-link:hover {
    border-color: #87beb3;
    background: #e5f5f1 !important;
    box-shadow: 0 7px 18px rgba(8, 124, 114, .10);
}
.navigation a.osn-network-link:focus-visible {
    outline: 3px solid rgba(91, 169, 189, .38);
    outline-offset: 2px;
}

/* Controls */
.btn,
button.primary,
input[type="submit"],
.navigation a.btn {
    min-height: 2.72rem;
    border-color: var(--osn-brand) !important;
    border-radius: 999px !important;
    background: var(--osn-brand) !important;
    box-shadow: 0 7px 18px rgba(8, 124, 114, .16) !important;
}
.btn:hover,
button.primary:hover,
input[type="submit"]:hover,
.navigation a.btn:hover {
    border-color: var(--osn-brand-strong) !important;
    background: var(--osn-brand-strong) !important;
    box-shadow: 0 10px 24px rgba(8, 124, 114, .2) !important;
}
.btn.secondary,
button.secondary,
.btn.ghost,
.btn.outline {
    border-color: var(--osn-line-strong) !important;
    background: #fff !important;
    color: var(--osn-brand-strong) !important;
    box-shadow: none !important;
}
.btn.secondary:hover,
button.secondary:hover,
.btn.ghost:hover,
.btn.outline:hover { border-color: #9fc9bf !important; background: var(--osn-brand-soft) !important; }

input, select, textarea, .tool-select {
    border-color: var(--osn-line-strong) !important;
    border-radius: var(--osn-radius-sm) !important;
    background: #fff !important;
    color: var(--osn-ink) !important;
}
input:focus, select:focus, textarea:focus {
    border-color: var(--osn-brand) !important;
    box-shadow: 0 0 0 4px rgba(8, 124, 114, .11) !important;
}

/* Shared cards and dialogs */
.card, .panel,
.content > section,
.project-card,
.log-entry,
.protocol-card,
.inventory-card,
.stats-grid > div,
.stat,
.recent,
.literature-feed,
.chat-composer,
.context-panel,
.osn-modal,
.auth-card,
.pwa-install-banner {
    border-color: var(--osn-line) !important;
    border-radius: var(--osn-radius) !important;
    background: var(--osn-surface) !important;
    box-shadow: var(--osn-shadow-sm) !important;
}
.osn-modal-overlay { background: rgba(12, 48, 44, .46) !important; backdrop-filter: blur(6px); }
.osn-modal { overflow: hidden; }
.osn-modal-header,
.osn-modal-actions { border-color: var(--osn-line) !important; background: #fffdf8 !important; }

table, .table-wrap, .table-scroll { border-color: var(--osn-line) !important; border-radius: var(--osn-radius-sm) !important; }
th { background: #f0f7f4 !important; color: var(--osn-ink-soft) !important; }
tr:hover td { background: #fbfdfb; }
.badge, .chip, .tag, .status-pill, .activity-type, .source-chip {
    border-color: var(--osn-line-strong) !important;
    border-radius: 999px !important;
    background: var(--osn-brand-soft) !important;
    color: var(--osn-brand-strong) !important;
}

/* Application shell */
.app-container { background: var(--osn-bg) !important; }
.sidebar {
    width: 232px;
    flex-basis: 232px;
    padding: 1.15rem .85rem !important;
    border-right: 0 !important;
    background: var(--osn-brand-deep) !important;
    color: #f4fffc;
    box-shadow: 10px 0 32px rgba(7, 91, 85, .09);
}
.sidebar h2 {
    margin-bottom: 1rem;
    padding: .55rem .6rem .75rem !important;
    border-bottom: 1px solid rgba(255, 255, 255, .13);
}
.sidebar h2 a {
    display: flex;
    justify-content: center;
    padding: .55rem;
    border-radius: var(--osn-radius-sm);
    background: #fffefa;
}
.sidebar .app-brand-logo { width: 120px; max-height: 62px; }
.sidebar nav, .sidebar-more-links { gap: .28rem; }
.sidebar nav a,
.sidebar-more summary,
.sidebar-more-links a {
    margin: 0 !important;
    padding: .68rem .78rem !important;
    border-radius: 11px !important;
    color: rgba(244, 255, 252, .78) !important;
    font-weight: 620 !important;
}
.sidebar nav a:hover,
.sidebar-more summary:hover,
.sidebar-more-links a:hover { background: rgba(255, 255, 255, .10) !important; color: #fff !important; }
.sidebar nav a.active {
    background: #f8f7f2 !important;
    color: var(--osn-brand-deep) !important;
    box-shadow: 0 8px 18px rgba(1, 48, 43, .18) !important;
}
.sidebar-more,
.sidebar .account-panel { border-top-color: rgba(255, 255, 255, .14) !important; }
.sidebar .account-user,
.sidebar .account-user span,
.sidebar .account-link strong { color: rgba(244, 255, 252, .80) !important; }
.sidebar .account-link:hover { border-color: rgba(255, 255, 255, .16) !important; background: rgba(255, 255, 255, .08) !important; }
.sidebar .btn.secondary { border-color: rgba(255, 255, 255, .28) !important; background: rgba(255, 255, 255, .10) !important; color: #fff !important; }

.content { max-width: 1560px; padding: clamp(1.5rem, 3vw, 2.75rem) !important; }
.content > h1,
.content header h1 { font-size: clamp(2rem, 3vw, 2.7rem) !important; line-height: 1.06; }

/* Dashboard */
.dashboard-content {
    display: grid;
    grid-template-columns: minmax(0, 1.7fr) minmax(19rem, .78fr);
    gap: 1.15rem;
    align-content: start;
}
.dashboard-content > .dashboard-page-header,
.dashboard-content > .stats { grid-column: 1 / -1; }
.dashboard-content > .literature-feed { grid-column: 1; margin: 0; }
.dashboard-content > .recent { grid-column: 2; margin: 0; }
.dashboard-page-header { padding: .25rem 0 .5rem; }
.stats {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .8rem !important;
    margin-bottom: 0 !important;
}
.stat { min-height: 8.25rem; padding: 1.25rem !important; text-align: left !important; }
.stat:nth-child(1) { background: var(--osn-sky) !important; }
.stat:nth-child(2) { background: var(--osn-peach) !important; }
.stat:nth-child(3) { background: var(--osn-lilac) !important; }
.stat strong, .stat .stat-value {
    display: block;
    margin-top: .5rem;
    color: var(--osn-ink) !important;
    font-family: var(--osn-font-display);
    font-size: 2rem;
    line-height: 1;
}
.literature-feed, .recent { padding: 1.25rem !important; }
.recent li { border-bottom-color: var(--osn-line) !important; }
.recent a { border-radius: var(--osn-radius-sm); }
.recent a:hover { background: #f6faf8; }

/* Public home */
.labbook-hero, .hero { border-bottom-color: var(--osn-line) !important; background: var(--osn-bg) !important; }
.hero {
    position: relative;
    overflow: hidden;
    padding: clamp(4.5rem, 9vw, 7.5rem) 0 clamp(4rem, 8vw, 6.5rem) !important;
}
.hero::before, .hero::after {
    position: absolute;
    z-index: 0;
    width: clamp(8rem, 18vw, 15rem);
    height: clamp(8rem, 18vw, 15rem);
    border-radius: 42% 58% 62% 38% / 45% 42% 58% 55%;
    content: "";
    pointer-events: none;
}
.hero::before { top: 12%; right: 5%; background: var(--osn-sky); transform: rotate(12deg); }
.hero::after {
    right: 15%; bottom: -10%;
    width: clamp(6rem, 13vw, 11rem); height: clamp(6rem, 13vw, 11rem);
    background: var(--osn-peach); transform: rotate(-16deg);
}
.hero > .container, .hero > * { position: relative; z-index: 1; }
.hero h2 {
    max-width: 930px !important;
    color: var(--osn-ink) !important;
    font-size: clamp(3rem, 6.5vw, 5.4rem) !important;
    font-weight: 700 !important;
    line-height: .98 !important;
}
.hero p { color: var(--osn-ink-soft) !important; }
.hero-eyebrow, .section-label, .section-kicker { color: var(--osn-brand) !important; letter-spacing: .11em; }
.trust-strip, .evidence-flow, .product-boundary { background: var(--osn-surface) !important; }
.features-preview { background: var(--osn-sky) !important; }
.workspace-preview {
    border-color: var(--osn-line-strong) !important;
    border-radius: var(--osn-radius-lg) !important;
    background: #fff !important;
    box-shadow: var(--osn-shadow) !important;
}
.preview-header, .preview-nav { background: #f5faf8 !important; }
.preview-nav .is-active { border-radius: var(--osn-radius-xs) !important; color: var(--osn-brand-strong) !important; }
.flow-grid, .features-grid { gap: .85rem; border: 0 !important; }
.flow-grid article, .feature {
    padding: 1.45rem !important;
    border: 1px solid var(--osn-line) !important;
    border-radius: var(--osn-radius) !important;
    background: rgba(255, 254, 250, .82) !important;
}
.feature:hover { background: #fff !important; box-shadow: var(--osn-shadow-sm); }
.app-download-callout { border-color: rgba(255, 255, 255, .12) !important; background: var(--osn-brand-deep) !important; }
.app-download-callout .btn { border-color: #fffefa !important; background: #fffefa !important; color: var(--osn-brand-deep) !important; }

/* Authentication */
.auth-page { background: var(--osn-bg) !important; color: var(--osn-ink) !important; }
.auth-story { background: var(--osn-brand-deep) !important; }
.auth-story h1 { color: #fffefa; font-size: clamp(2.8rem, 5vw, 5.2rem) !important; font-weight: 700 !important; }
.auth-story > div > p:last-child,
.auth-story-foot { color: rgba(255, 255, 255, .76) !important; }
.auth-panel { background: var(--osn-bg); }
.auth-card { border-radius: var(--osn-radius-lg) !important; background: var(--osn-surface) !important; box-shadow: var(--osn-shadow) !important; }
.auth-card header h1,
.auth-card header h2 { color: var(--osn-ink) !important; font-weight: 700 !important; }
.auth-submit { border-radius: 999px !important; }

/* AI workspace */
.chat-page, .chat-workspace, .agent-workspace-shell { background: var(--osn-bg) !important; }
.chat-header, .conversation-panel { border-color: var(--osn-line) !important; background: var(--osn-surface) !important; }
.chat-thread, .chat-messages { background: #fbfaf6 !important; }
.chat-message.user, .chat-message.is-user { background: var(--osn-sky) !important; color: var(--osn-ink) !important; }
.chat-message.assistant, .chat-message.is-assistant { border-color: var(--osn-line) !important; background: #fff !important; }
.chat-composer { border-color: var(--osn-line) !important; background: rgba(255, 254, 250, .96) !important; }

/* Product update center */
.osn-update-section {
    grid-column: 1 / -1;
    padding: 1.2rem;
    border: 1px solid var(--osn-line);
    border-radius: var(--osn-radius);
    background: linear-gradient(135deg, #fffefa 0%, #f1faf7 100%);
    box-shadow: var(--osn-shadow-sm);
}
.osn-update-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .85rem; }
.osn-update-section-heading h2, .osn-update-section-heading p { margin: 0; }
.osn-update-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .8rem; }
.osn-update-card { position: relative; min-width: 0; padding: 1rem; border: 1px solid var(--osn-line); border-radius: var(--osn-radius-sm); background: rgba(255,255,255,.86); }
.osn-update-card.is-unread { border-color: #82c9b9; box-shadow: inset 3px 0 0 var(--osn-brand); }
.osn-update-card h3 { margin: .45rem 0 .35rem; color: var(--osn-ink); font-size: 1rem; line-height: 1.35; }
.osn-update-card p { margin: 0; color: var(--osn-ink-soft); font-size: .88rem; line-height: 1.55; }
.osn-update-meta, .osn-update-actions { display: flex; align-items: center; flex-wrap: wrap; gap: .45rem; }
.osn-update-meta { color: #687a75; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.osn-update-new, .osn-update-kind { padding: .14rem .42rem; border-radius: 999px; background: var(--osn-brand-soft); color: var(--osn-brand-strong); }
.osn-update-actions { margin-top: .75rem; }
.osn-update-actions a, .osn-update-actions button, .osn-update-drawer-tools button { padding: 0; border: 0; background: transparent; color: var(--osn-brand-strong); font: inherit; font-size: .82rem; font-weight: 750; cursor: pointer; text-decoration: none; }
.osn-update-actions a:hover, .osn-update-actions button:hover, .osn-update-drawer-tools button:hover { text-decoration: underline; }
.osn-update-empty { margin: 0; padding: .8rem; color: var(--osn-ink-soft); }
.osn-update-launcher { position: fixed; right: 1rem; bottom: 1rem; z-index: 870; display: flex; align-items: center; gap: .42rem; min-height: 2.8rem; padding: .65rem .9rem; border: 1px solid #b8d8d0; border-radius: 999px; background: #fff; color: var(--osn-brand-strong); box-shadow: var(--osn-shadow); font: inherit; font-weight: 750; cursor: pointer; }
.osn-update-launcher b { display: grid; place-items: center; min-width: 1.35rem; height: 1.35rem; padding: 0 .28rem; border-radius: 999px; background: #d9584e; color: #fff; font-size: .7rem; }
.osn-update-launcher { touch-action: none; user-select: none; -webkit-user-select: none; cursor: grab; }
.osn-update-launcher.is-dragging { cursor: grabbing; }
.osn-update-launcher[hidden], .osn-update-launcher b[hidden] { display: none !important; }
.osn-update-backdrop { position: fixed; inset: 0; z-index: 880; background: rgba(19,42,37,.36); backdrop-filter: blur(2px); }
.osn-update-drawer { position: fixed; top: 0; right: 0; bottom: 0; z-index: 890; width: min(28rem, 94vw); overflow-y: auto; padding: 1rem; border-left: 1px solid var(--osn-line); background: var(--osn-surface); box-shadow: -18px 0 45px rgba(19,42,37,.14); }
.osn-update-drawer[hidden], .osn-update-backdrop[hidden] { display: none; }
.osn-update-drawer > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; padding-bottom: .8rem; border-bottom: 1px solid var(--osn-line); }
.osn-update-drawer > header p, .osn-update-drawer > header h2 { margin: 0; }
.osn-update-drawer > header p { color: var(--osn-brand-strong); font-size: .75rem; font-weight: 800; text-transform: uppercase; }
.osn-update-drawer > header button { width: 2.35rem; height: 2.35rem; border: 1px solid var(--osn-line); border-radius: 50%; background: #fff; color: var(--osn-ink); font-size: 1.35rem; cursor: pointer; }
.osn-update-drawer-tools { padding: .75rem 0; text-align: right; }
.osn-update-drawer-list { display: grid; gap: .65rem; }
.osn-update-card.is-compact { background: #fff; }

/* Feedback states */
.success, .notice.success, .alert-success { border-color: #b6ded3 !important; background: var(--osn-brand-soft) !important; color: var(--osn-brand-strong) !important; }
.warning, .notice.warning, .alert-warning { border-color: #f7cfaa !important; background: #fff7e9 !important; color: #775224 !important; }
.error, .notice.error, .alert-error { border-color: #efc0b7 !important; background: var(--osn-danger-soft) !important; color: #9a3f35 !important; }
.footer { border-top-color: var(--osn-line) !important; background: var(--osn-surface) !important; }

@media (max-width: 980px) {
    .dashboard-content { grid-template-columns: 1fr; }
    .dashboard-content > .dashboard-page-header,
    .dashboard-content > .stats,
    .dashboard-content > .literature-feed,
    .dashboard-content > .recent { grid-column: 1; }
}

@media (max-width: 820px) {
    .sidebar { background: rgba(255, 254, 250, .97) !important; border-bottom-color: var(--osn-line) !important; }
    .sidebar h2 { margin: 0 !important; padding: 0 !important; border-bottom: 0; }
    .sidebar h2 a { justify-content: flex-start; padding: 0; background: transparent; }
    .sidebar nav a,
    .sidebar-more summary,
    .sidebar-more-links a { color: var(--osn-ink-soft) !important; }
    .sidebar nav a:hover,
    .sidebar-more summary:hover,
    .sidebar-more-links a:hover { background: var(--osn-brand-soft) !important; color: var(--osn-brand-strong) !important; }
    .sidebar nav a.active { border-color: #b8d8d0 !important; background: var(--osn-brand-soft) !important; color: var(--osn-brand-strong) !important; box-shadow: none !important; }
    .sidebar .account-user,
    .sidebar .account-user span,
    .sidebar .account-link strong { color: var(--osn-ink-soft) !important; }
    .sidebar .btn.secondary { border-color: var(--osn-line-strong) !important; background: #fff !important; color: var(--osn-brand-strong) !important; }
    .stats { grid-template-columns: 1fr !important; }
    .osn-update-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
    .hero::before { top: 7%; right: -3.5rem; opacity: .72; }
    .hero::after { right: -1.5rem; opacity: .75; }
    .hero h2,
    html[lang="zh-CN"] .hero h2 { font-size: clamp(2.45rem, 12vw, 3.4rem) !important; }
    .auth-card { border-radius: var(--osn-radius) !important; }
    .flow-grid, .features-grid { gap: .7rem; }
    .osn-update-section-heading { align-items: stretch; flex-direction: column; }
    .osn-update-launcher { right: .75rem; bottom: calc(.75rem + env(safe-area-inset-bottom)); }
}

@media (prefers-reduced-motion: reduce) {
    .hero::before, .hero::after { transform: none; }
}
