:root {
  --paper: #eaf6fa; --paper-deep: #dceef4; --ink: #263f49; --muted: #56707a;
  --navy: #276879; --navy-soft: #276879; --line: #dce3e6; --green: #426f58;
  --radius-xl: 8px; --radius-lg: 8px;
  --font-sans: "Microsoft YaHei UI", "Noto Sans SC", system-ui, sans-serif;
}
* { letter-spacing: 0 !important; }
[hidden] { display: none !important; }
body { background: var(--paper); font-family: var(--font-sans); font-size: 0.875rem; min-width: 320px; }
.app-bg { display: none; }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: wait; opacity: .6; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid #78a9b7; outline-offset: 3px; }
button, a, p, h1, h2, h3, strong, small { overflow-wrap: anywhere; }
a { color: var(--navy); }
.lucide { width: 18px; height: 18px; flex: 0 0 18px; vertical-align: middle; }
.app-shell { grid-template-columns: 220px minmax(0, 1fr); grid-template-rows: 68px minmax(calc(100vh - 68px), auto); }
.topbar { height: 68px; padding: 0 22px; gap: 18px; background: #fff; backdrop-filter: none; }
.brand-button { min-width: 175px; }
.brand-button strong { font-size: 1.3125rem; }
.brand-button small { font-size: 0.5625rem; }
.global-search { background: #f4fbfd; border-radius: 6px; padding: 8px 12px; }
.profile-switcher, .profile-menu { border-radius: 6px; background: white; }
.profile-switcher { min-height: 38px; }
.sidebar { background: #e3f1f5 !important; padding: 20px 12px; position: sticky; top: 68px; height: calc(100vh - 68px); overflow-y: auto; }
.current-person-card { border-radius: 6px; background: white; padding: 10px; }
.side-nav { margin-top: 18px; }
.nav-label { color: #596b70; margin: 18px 0 6px; }
.nav-item { min-height: 40px; border-radius: 6px; color: #40545d; box-shadow: none !important; }
.nav-item.active { background: #d8e9ec; color: #174a58; }
.nav-item.active span { color: #174a58; }
.nav-item:hover { background: #e3ecee; }
.sidebar-footer { padding-top: 20px; }
.settings-link { display: flex; align-items: center; gap: 10px; min-height: 40px; }
.main-content { padding: 28px 36px 60px; width: 100%; min-width: 0; max-width: 1600px; margin: 0 auto; }
.page-heading { margin: 0 0 26px; padding: 0 0 20px; border-bottom: 1px solid var(--line); gap: 20px; }
.page-heading h1, .compact-heading h1 { font-family: var(--font-sans); font-size: 1.75rem; font-weight: 600; line-height: 1.4; margin: 0; }
.page-heading p { font-size: 0.8125rem; line-height: 1.8; color: var(--muted); margin: 7px 0 0; }
.heading-actions, .button-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.primary-button, .secondary-button, .text-button { display: inline-flex; justify-content: center; align-items: center; gap: 7px; min-height: 38px; border-radius: 6px; font-size: 0.8125rem; white-space: normal; text-decoration: none; }
.primary-button, .secondary-button { padding: 9px 13px; }
.primary-button { background: #276879; color: white; }
.secondary-button { border: 1px solid #ccd8dd; background: white; color: #294a58; }
.text-button { background: transparent; padding: 4px 6px; }
.icon-button { width: 38px; height: 38px; min-width: 38px; display: inline-flex; align-items: center; justify-content: center; border-radius: 6px; }
.icon-button[aria-pressed=true] { background: #fff0c9; color: #765414; }
.danger { color: #a3364f; }
.section-title h2, .section-block h2 { font-size: 1.1875rem; font-family: var(--font-sans); font-weight: 600; }
.section-block { margin-top: 28px; }
.card.panel, .weather-panel.card { border: 0; border-radius: 0; background: transparent; box-shadow: none; padding: 0; }
.quiet-empty { padding: 28px 16px; color: #55717b; text-align: center; background: #dceef4; border-radius: 6px; line-height: 1.8; }
.dashboard-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-bottom: 1px solid var(--line); padding: 0 0 24px; margin-bottom: 24px; gap: 16px; }
.dashboard-stats > div { border-left: 3px solid #88b0b8; padding-left: 14px; }
.dashboard-stats > div:nth-child(2) { border-color: #b392ae; }
.dashboard-stats > div:nth-child(3) { border-color: #8aaa8d; }
.dashboard-stats > div:nth-child(4) { border-color: #cd959d; }
.dashboard-stats span { display: block; color: var(--muted); font-size: 0.8125rem; }
.dashboard-stats strong { display: block; font-size: 1.875rem; margin-top: 4px; }
.workspace-columns { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 36px; }
.workspace-columns .section-title { margin: 0 0 14px; padding: 0; }
.workspace-columns .section-title:not(:first-child) { margin-top: 28px; }
.record-row { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 15px; padding: 16px 0; border-bottom: 1px solid var(--line); background: transparent; text-align: left; }
.record-row > span { min-width: 0; }
.record-row strong { font-size: 0.875rem; line-height: 1.65; }
.record-row small { display: block; margin-top: 6px; color: var(--muted); font-size: 0.75rem; }
.record-row > span > .lucide { margin-right: 8px; color: #68868f; }
.record-row:hover { background: #eff4f5; }
.today-grid, .health-overview { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin: 20px 0; }
.today-grid span, .health-overview span { display: block; color: var(--muted); font-size: 0.8125rem; }
.today-grid strong, .health-overview strong { display: block; font-size: 1.4375rem; margin: 7px 0 3px; }
.today-grid small, .health-overview small { color: var(--muted); }
.album-entry, .public-gallery-entry { display: flex; gap: 14px; align-items: center; text-decoration: none; padding: 22px 18px; background: #e6eef0; border-radius: 6px; }
.album-entry small, .public-gallery-entry small { display: block; color: var(--muted); margin-top: 5px; }
.album-entry > .lucide:last-child, .public-gallery-entry > .lucide:last-child { margin-left: auto; }
.public-gallery-entry { max-width: 700px; margin: 30px auto 0; text-align: left; }
.landing { padding-top: 4px; }
.landing-head h1 { font-size: 3.25rem; margin: 16px 0; }
.landing-head p { font-size: 0.875rem; }
.people-stage { margin-top: 28px; }
.person-entry { border-radius: 8px; background: white; box-shadow: none; }
.person-entry:before { display: none; }
.teacher-art { height: 220px; max-width: 100%; border-radius: 6px; object-fit: cover; }
.landing-foot { display: none; }
.filter-bar { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; margin-bottom: 22px; }
.filter-bar > span { color: var(--muted); align-self: center; margin-left: auto; }
.filter-bar label, .project-group-card label, .paper-detail-actions label { display: flex; flex-direction: column; gap: 7px; color: var(--muted); font-size: 0.75rem; min-width: 0; }
input:not([type=checkbox]), select, textarea { min-width: 0; max-width: 100%; padding: 10px 11px; background: #fff; border: 1px solid #cdd8de; border-radius: 6px; color: var(--ink); }
input:not([type=checkbox]), select { min-height: 40px; }
textarea { resize: vertical; line-height: 1.7; }
.filter-bar input[type=search] { width: 300px; }
.filter-bar .check-label { display: flex; flex-direction: row; align-items: center; align-self: center; gap: 8px; font-size: 0.875rem; }
input[type=checkbox] { width: 18px; height: 18px; accent-color: #276879; }
.note-row { display: flex; justify-content: space-between; gap: 12px; padding: 18px 0; border-bottom: 1px solid var(--line); }
.note-main { flex: 1; min-width: 0; background: transparent; text-align: left; padding: 0; }
.note-main h2 { font-size: 1.125rem; margin: 0 0 8px; }
.note-main p { color: var(--muted); line-height: 1.7; white-space: pre-wrap; margin: 0 0 10px; }
.note-main small { color: #647680; }
.note-row > div { display: flex; align-items: flex-start; }
.project-group-grid { gap: 24px; }
.project-group-card { border: 1px solid var(--line); background: white; border-radius: 8px; padding: 20px; }
.project-group-card label + label { margin-top: 16px; }
.project-group-card textarea { height: 100px; }
.health-overview { grid-template-columns: repeat(4, minmax(0, 1fr)); border-bottom: 1px solid var(--line); padding-bottom: 22px; }
.health-chart { position: relative; height: 270px; width: 100%; margin-bottom: 20px; }
.health-chart:has(.quiet-empty) { height: auto; }
.health-record { display: flex; align-items: flex-start; gap: 16px; border-bottom: 1px solid var(--line); padding: 16px 0; }
.health-record time { color: var(--muted); flex: 0 0 100px; font-size: 0.75rem; padding-top: 3px; }
.health-record > div { flex: 1; min-width: 0; }
.health-record p { color: var(--muted); white-space: pre-wrap; margin: 6px 0 0; }
.medication { gap: 12px; }
.medication > div { flex: 1; }
.paper-workspace { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 22px; align-items: start; }
.paper-navigation { max-height: 75vh; overflow-y: auto; border-right: 1px solid var(--line); padding-right: 12px; }
.paper-entry { display: block; padding: 12px; width: 100%; text-align: left; border-radius: 6px; background: transparent; margin-bottom: 6px; }
.paper-entry.active { background: #e0ecef; }
.paper-entry strong { font-size: 0.8125rem; line-height: 1.6; }
.paper-entry small { display: block; font-size: 0.6875rem; color: var(--muted); margin-top: 6px; }
.paper-reader { min-width: 0; background: white; border: 1px solid var(--line); border-radius: 6px; padding: 18px; }
.reader-toolbar { padding: 0 0 16px; gap: 12px; border: 0; background: transparent; }
.reader-toolbar strong { font-size: 1.0625rem; }
.reader-toolbar small { display: block; line-height: 1.7; margin-top: 6px; }
.paper-detail-actions { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.paper-detail-actions label { max-width: 240px; }
.document-page { padding: 24px 0; box-shadow: none; background: transparent; min-height: 0; }
.document-page h2 { font-family: var(--font-sans); font-size: 1.4375rem; line-height: 1.5; margin-top: 0; }
.document-page p { font-family: var(--font-sans); font-size: 0.875rem; line-height: 1.9; }
.abstract-text { white-space: pre-wrap; }
.paper-doi { color: var(--muted); }
.pdf-page-stack figure { margin: 20px 0; }
.pdf-page-image { width: 100%; height: auto; }
figcaption { text-align: center; color: var(--muted); font-size: 0.75rem; padding: 7px; }
.modal-backdrop { z-index: 100; padding: 24px; background: #20303880; backdrop-filter: blur(3px); overflow-y: auto; }
.modal-card { width: min(600px, 100%); max-height: calc(100dvh - 48px); overflow-y: auto; background: #fff; border-radius: 8px; padding: 24px; }
.wide-modal { width: min(920px, 100%); }
.modal-header { align-items: flex-start; gap: 14px; margin-bottom: 20px; }
.modal-header h2 { font-family: var(--font-sans); font-size: 1.375rem; margin: 0; line-height: 1.5; }
.modal-header > .icon-button { margin: -6px -6px 0 0; }
.paper-form { display: flex; flex-direction: column; gap: 16px; }
.paper-form label { display: flex; flex-direction: column; gap: 7px; font-size: 0.8125rem; color: var(--muted); }
.paper-form input, .paper-form select, .paper-form textarea { width: 100%; font-size: 0.875rem; }
.paper-form input[type=file] { white-space: normal; }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }
.modal-open { overflow: hidden; }
.form-help { font-size: 0.75rem; color: #566d78; line-height: 1.8; }
.form-error { color: #a1324b; font-size: 0.8125rem; line-height: 1.8; margin: 14px 0 0; }
.form-error:empty { display: none; }
.online-result { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 18px 0; background: transparent; }
.online-result h3 { font-size: 1rem; line-height: 1.6; }
.online-result small { overflow-wrap: anywhere; color: var(--muted); }
.online-error { background: #faedf0; border-radius: 6px; padding: 20px; }
.results-summary { margin-top: 24px; color: var(--muted); }
.settings-section { max-width: 860px; padding: 0 0 28px; margin-bottom: 28px; border-bottom: 1px solid var(--line); }
.settings-section h2, .help-content h2 { font-size: 1.1875rem; }
.settings-section p, .help-content p { line-height: 1.9; }
.settings-section dl { display: grid; grid-template-columns: 180px 1fr; gap: 12px; margin: 22px 0; }
.settings-section dt { color: var(--muted); }
.settings-section dd { margin: 0; }
.help-content { max-width: 820px; }
.help-content section { margin-bottom: 32px; }
.search-section { margin: 28px 0; }
.search-section h2 { font-size: 1.1875rem; }
.search-section h2 small { color: var(--muted); font-size: 0.8125rem; margin-left: 10px; }
.gallery-mode .main-content { max-width: 1550px; }
.gallery-breadcrumb { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.gallery-breadcrumb a { text-decoration: none; }
.gallery-breadcrumb .text-button { margin-left: auto; }
.album-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 26px; }
.album-card { min-width: 0; text-decoration: none; color: var(--ink); }
.album-cover { aspect-ratio: 4/3; position: relative; background: #e5ecef; overflow: hidden; border-radius: 6px; }
.album-cover img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .2s; }
.album-card:hover img { transform: scale(1.025); }
.album-cover > span { position: absolute; right: 10px; bottom: 10px; color: white; background: #24343bbf; padding: 4px 8px; border-radius: 4px; font-size: 0.75rem; }
.album-placeholder { display: flex; align-items: center; justify-content: center; height: 100%; color: #76939e; }
.album-placeholder .lucide { width: 42px; height: 42px; }
.album-card-copy { padding: 12px 0; }
.album-card-copy h2 { font-family: var(--font-sans); font-size: 1.0625rem; margin: 0; line-height: 1.6; }
.album-card-copy p { margin: 6px 0 0; color: var(--muted); font-size: 0.75rem; }
.photo-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.photo-tile { min-width: 0; }
.photo-open { width: 100%; height: auto; aspect-ratio: 4/3; padding: 0; display: block; background: #e4eaed; border-radius: 6px; overflow: hidden; }
.photo-open img { width: 100%; height: 100%; object-fit: contain; }
.photo-caption { display: flex; align-items: flex-start; gap: 4px; padding: 12px 0; }
.photo-caption > div { flex: 1; min-width: 0; }
.photo-caption strong { font-size: 0.875rem; line-height: 1.5; }
.photo-caption small { display: block; font-size: 0.6875rem; margin-top: 5px; color: var(--muted); }
.pswp { z-index: 200; }
.pswp__caption { position: absolute; bottom: 15px; left: 15%; right: 15%; padding: 10px; color: white; background: #0009; text-align: center; border-radius: 4px; max-height: 110px; overflow-y: auto; font-size: 0.8125rem; }
.pswp__download { display: flex; align-items: center; color: white; text-decoration: none; padding: 0 14px; }
.pswp__button { border-radius: 0; }
.toast { z-index: 250; max-width: calc(100vw - 32px); font-size: 0.875rem; }
.mobile-search-button { display: none; }
@media (min-width:901px) {
  #app.sidebar-collapsed { grid-template-columns: 0 minmax(0, 1fr); }
  #app.sidebar-collapsed .sidebar { visibility: hidden; overflow: hidden; padding: 0; width: 0; }
  #app.sidebar-collapsed .main-content { grid-column: 2; }
}
@media (max-width:1100px) {
  .main-content { padding: 24px; }
  .album-grid, .photo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .workspace-columns { gap: 24px; }
  .paper-workspace { grid-template-columns: 210px minmax(0, 1fr); }
}
@media (max-width:900px) {
  #app, #app.sidebar-collapsed { display: block; min-height: 100vh; }
  .topbar { height: 64px; gap: 10px; padding: 0 14px; position: sticky; z-index: 45; }
  .brand-button { min-width: 0; flex: 1; }
  .brand-button > span:last-child { display: block; }
  .brand-button strong { font-size: 1.125rem; }
  .brand-button small { display: none; }
  .global-search { display: none; }
  .mobile-search-button { display: inline-flex; }
  .top-actions { gap: 4px; }
  .top-actions > [data-view=help] { display: none; }
  .profile-switcher { font-size: 0.75rem; padding: 6px; }
  #app .sidebar, #app.sidebar-collapsed .sidebar { position: fixed !important; top: 64px; bottom: 0; left: 0; width: min(290px, 85vw) !important; height: calc(100dvh - 64px); padding: 20px 12px; transform: translateX(-105%) !important; opacity: 1 !important; visibility: visible; background: #e3f1f5 !important; backdrop-filter: none !important; z-index: 44; overflow-y: auto; transition: transform .18s; }
  #app.mobile-sidebar-open .sidebar { transform: translateX(0) !important; }
  #sidebarBackdrop { position: fixed; inset: 64px 0 0; z-index: 20; background: #20353c80; }
  body.mobile-sidebar-open { overflow: hidden; }
  .sidebar-collapsed .nav-item, .sidebar-collapsed .nav-label { font-size: 0.875rem; justify-content: flex-start; }
  .sidebar-collapsed .current-person-card { display: flex; }
  .sidebar-collapsed .current-person-card > div { display: block; }
  .sidebar-collapsed .nav-item { padding: 11px 12px; }
  .main-content { padding: 22px 18px 40px; }
  .page-heading { align-items: flex-start; flex-direction: column; gap: 14px; }
  .page-heading h1, .compact-heading h1 { font-size: 1.5rem; }
  .heading-actions { width: 100%; }
  .workspace-columns { grid-template-columns: 1fr; }
  .paper-workspace { grid-template-columns: 1fr; }
  .paper-navigation { max-height: 230px; border-right: 0; border-bottom: 1px solid var(--line); padding: 0 0 12px; }
  .health-record { gap: 8px; flex-wrap: wrap; }
  .health-record time { flex-basis: 100%; }
  .health-record > div { flex-basis: 60%; }
  .health-chart { height: 230px; }
  .health-overview { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .landing-head h1 { font-size: 2.25rem; }
  .landing-head { padding-top: 0; }
  .people-stage { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
  .people-stage .connection { grid-column: 1/-1; grid-row: 2; min-height: 70px; }
  .person-entry { padding: 16px 10px; }
  .teacher-art { height: 185px; width: 140px; }
  .person-entry h2 { font-size: 1.3125rem; }
  .person-entry p { font-size: 0.6875rem; line-height: 1.7; }
  .connection-node { width: 70px; height: 70px; }
  .public-gallery-entry { margin-top: 20px; }
  .photo-grid { gap: 16px; }
  .modal-backdrop { padding: 12px; align-items: center; }
  .modal-card { padding: 20px; max-height: calc(100dvh - 24px); }
  .modal-header h2 { font-size: 1.25rem; }
  .online-result { flex-direction: column; gap: 12px; }
  .document-page h2 { font-size: 1.25rem; }
  .settings-section dl { grid-template-columns: 1fr; gap: 6px; }
  .settings-section dd { margin-bottom: 12px; }
}
@media (max-width:520px) {
  .brand-mark { display: none; }
  .brand-button strong { font-size: 1rem; }
  .topbar { gap: 6px; padding: 0 10px; }
  .topbar .icon-button { min-width: 32px; width: 32px; }
  .sidebar-toggle-button { width: 34px; min-width: 34px; }
  .dashboard-stats { gap: 12px; }
  .dashboard-stats > div { padding-left: 8px; }
  .dashboard-stats strong { font-size: 1.5625rem; }
  .dashboard-stats span { font-size: 0.6875rem; }
  .filter-bar label:not(.check-label) { flex: 1 1 150px; }
  .filter-bar input[type=search] { width: 100%; }
  .album-grid { gap: 16px; }
  .album-card-copy h2 { font-size: 0.9375rem; }
  .photo-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .photo-caption strong { font-size: 0.9375rem; }
  .note-row { flex-wrap: wrap; }
  .note-main { flex-basis: 100%; }
  .pswp__caption { left: 4%; right: 4%; font-size: 0.75rem; }
}
@media (prefers-reduced-motion:reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}

/* Team Library pass: shared design tokens and component states */
:root {
  --brand-primary: #5b54e8;
  --brand-primary-hover: #4841c9;
  --brand-accent: #ed4fa5;
  --brand-accent-soft: #fff0f8;
  --surface: #ffffff;
  --surface-soft: #f7f8fc;
  --text-title: 2.125rem;
  --text-section: 1.25rem;
  --text-body: 0.8125rem;
  --text-small: 0.6875rem;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
}
body { font-size: var(--text-body); }
.page-heading h1, .compact-heading h1 { font-size: var(--text-title); letter-spacing: -.02em !important; }
.section-title h2, .section-block h2, .search-section h2, .settings-section h2, .help-content h2 { font-size: var(--text-section); }
.page-heading p, .section-title p, .form-help, .settings-section p, .help-content p { font-size: var(--text-body); }
.primary-button { background: var(--brand-primary); border: 1px solid var(--brand-primary); }
.primary-button:hover { background: var(--brand-primary-hover); }
.secondary-button { border-color: #d9dce8; background: var(--surface); }
.secondary-button:hover { border-color: var(--brand-primary); color: var(--brand-primary); background: #f7f7ff; }
input:not([type=checkbox]), select, textarea { border-color: #d9dce8; background: var(--surface); }
input:not([type=checkbox]):focus, select:focus, textarea:focus { border-color: var(--brand-primary); box-shadow: 0 0 0 3px #5b54e822; outline: 0; }
.card, .project-group-card, .paper-reader, .modal-card { border-radius: 12px; }
.project-group-card, .paper-reader { box-shadow: 0 2px 12px #263f4910; }
.nav-item.active { background: #eeedff; color: #3f39aa; border-left: 3px solid var(--brand-primary); }
.nav-item.active span, .nav-item.active .lucide { color: var(--brand-primary); }
.icon-button:hover { background: #f0efff; color: var(--brand-primary); }
.quiet-empty { background: var(--surface-soft); border: 1px dashed #c9ccda; }
.tag, .badge, .chip { border-radius: 999px; }
@media (max-width: 900px) {
  .page-heading h1, .compact-heading h1 { font-size: 1.75rem; }
}
