* { box-sizing: border-box; }
html, body { margin: 0; min-width: 1180px; min-height: 100%; background: var(--bg); color: var(--fg); font-family: var(--font-body); }
body { font-size: var(--text-sm); line-height: var(--leading-body); }
button, input, select, textarea { font: inherit; color: inherit; }
button, a, input, select, textarea { transition: border-color var(--motion-fast) var(--ease-standard), background var(--motion-fast) var(--ease-standard), color var(--motion-fast) var(--ease-standard), box-shadow var(--motion-fast) var(--ease-standard), transform var(--motion-fast) var(--ease-standard); }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; box-shadow: var(--focus-ring); }
a { color: inherit; text-decoration: none; }
svg { width: 18px; height: 18px; stroke: currentColor; stroke-width: 1.7; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.app { min-height: 100vh; display: grid; grid-template-columns: 224px minmax(0, 1fr); grid-template-rows: 64px minmax(0, 1fr); }
.sidebar { grid-row: 1 / 3; background: var(--surface); border-right: 1px solid var(--border); padding: 20px 14px; position: relative; height: 100vh; display: flex; flex-direction: column; z-index: 20; }
.brand { height: 40px; display: flex; align-items: center; gap: 11px; padding: 0 10px; font-size: var(--text-base); font-weight: 650; letter-spacing: -.01em; }
.brand-mark { width: 28px; height: 28px; border-radius: var(--radius-sm); background: var(--primary); display: grid; place-items: center; color: var(--accent-on); box-shadow: 0 1px 2px color-mix(in oklab, var(--primary), transparent 75%); }
.nav { margin-top: 24px; display: grid; gap: 4px; }
.nav a { min-height: 42px; display: flex; align-items: center; gap: 12px; padding: 0 12px; border-radius: var(--radius-sm); color: var(--muted); font-weight: 520; letter-spacing: .01em; }
.nav a:hover { background: var(--primary-soft); color: var(--primary); }
.nav a.active { background: var(--primary-soft); color: var(--primary); font-weight: 620; }
.sidebar-bottom { margin-top: auto; border-top: 1px solid var(--border); padding-top: 16px; }
.role-card { padding: 10px; display: flex; gap: 10px; align-items: center; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--primary); color: var(--accent-on); font-size: var(--text-xs); font-weight: 650; }
.role-meta { min-width: 0; }
.role-meta strong { display: block; font-size: var(--text-sm); font-weight: 600; }
.role-meta span { display: block; color: var(--muted); font-size: var(--text-xs); }
.topbar { grid-column: 2; height: 64px; background: color-mix(in oklab, var(--surface), transparent 3%); border-bottom: 1px solid var(--border); display: flex; align-items: center; padding: 0 28px; gap: 20px; position: relative; z-index: 15; }
.global-search { width: min(560px, 48vw); height: 38px; position: relative; }
.global-search input { width: 100%; height: 100%; padding: 0 44px 0 38px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg); }
.global-search input:hover { border-color: var(--muted); }
.global-search .search-icon { position: absolute; left: 12px; top: 10px; color: var(--muted); }
.global-search kbd { position: absolute; right: 9px; top: 8px; border: 1px solid var(--border); background: var(--surface); border-radius: 4px; padding: 2px 6px; font-family: var(--font-mono); color: var(--muted); font-size: 10px; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.icon-btn { width: 38px; height: 38px; border: 0; border-radius: var(--radius-sm); background: transparent; display: grid; place-items: center; cursor: pointer; color: var(--muted); position: relative; }
.icon-btn:hover { background: var(--primary-soft); color: var(--primary); }
.icon-btn[data-tooltip]:hover::after { content: attr(data-tooltip); position: absolute; top: calc(100% + 8px); right: 0; white-space: nowrap; padding: 5px 8px; border-radius: 5px; color: var(--accent-on); background: var(--fg); font-size: var(--text-xs); box-shadow: var(--elev-raised); z-index: 40; }
.main { grid-column: 2; min-width: 0; padding: 28px 32px 48px; }
.main.wide { padding: 0; }
.container { width: min(1180px, 100%); margin: 0 auto; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.eyebrow { color: var(--primary); font-size: var(--text-xs); font-weight: 650; text-transform: uppercase; letter-spacing: .08em; margin-bottom: 6px; }
h1, h2, h3 { margin: 0; font-family: var(--font-display); line-height: var(--leading-tight); letter-spacing: var(--tracking-display); text-wrap: balance; }
h1 { font-size: var(--text-2xl); font-weight: 650; }
h2 { font-size: var(--text-xl); font-weight: 620; }
h3 { font-size: var(--text-base); font-weight: 620; }
p { text-wrap: pretty; }
.subtle { color: var(--muted); }
.btn { min-height: 38px; border-radius: var(--radius-sm); border: 1px solid var(--border); padding: 0 14px; background: var(--surface); display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-weight: 570; letter-spacing: .02em; cursor: pointer; }
.btn:hover { background: var(--primary-soft); border-color: color-mix(in oklab, var(--primary), var(--border) 55%); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: var(--accent-on); border-color: var(--primary); box-shadow: 0 1px 2px color-mix(in oklab, var(--primary), transparent 65%); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-teal { background: var(--smart); color: var(--accent-on); border-color: var(--smart); }
.btn[disabled] { opacity: .46; cursor: not-allowed; transform: none; }
.btn-sm { min-height: 32px; padding: 0 10px; font-size: var(--text-xs); }
.badge { display: inline-flex; align-items: center; gap: 6px; min-height: 24px; padding: 2px 8px; border-radius: var(--radius-pill); border: 1px solid var(--border); color: var(--muted); background: var(--surface); font-size: var(--text-xs); white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.good { color: var(--success); background: var(--success-soft); border-color: color-mix(in oklab, var(--success), transparent 72%); }
.badge.warn { color: var(--warn); background: var(--warn-soft); border-color: color-mix(in oklab, var(--warn), transparent 72%); }
.badge.bad { color: var(--danger); background: var(--danger-soft); border-color: color-mix(in oklab, var(--danger), transparent 72%); }
.badge.info { color: var(--primary); background: var(--primary-soft); border-color: color-mix(in oklab, var(--primary), transparent 75%); }
.badge.smart { color: var(--smart); background: var(--smart-soft); border-color: color-mix(in oklab, var(--smart), transparent 72%); }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--elev-flat); }
.panel-head { min-height: 54px; padding: 0 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.panel-body { padding: 18px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.section-head a { color: var(--primary); font-size: var(--text-xs); font-weight: 600; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.stack { display: grid; gap: 16px; }
.tabs { min-height: 44px; display: flex; gap: 22px; align-items: flex-end; border-bottom: 1px solid var(--border); }
.tab { height: 44px; border: 0; border-bottom: 2px solid transparent; padding: 0 2px; background: transparent; color: var(--muted); cursor: pointer; font-weight: 540; }
.tab:hover { color: var(--fg); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 620; }
.field { display: grid; gap: 7px; }
.field label { font-size: var(--text-xs); font-weight: 590; }
.input, .select { width: 100%; height: 38px; padding: 0 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.input:hover, .select:hover { border-color: var(--muted); }
.search-hero { max-width: 900px; padding: 52px 0 38px; }
.search-hero h1 { font-size: var(--text-3xl); max-width: 680px; margin-bottom: 12px; }
.search-hero p { color: var(--muted); font-size: var(--text-base); margin: 0 0 24px; }
.hero-search { height: 58px; display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 7px; background: var(--surface); border: 1px solid color-mix(in oklab, var(--primary), var(--border) 70%); border-radius: var(--radius-md); box-shadow: var(--elev-raised); }
.hero-search input { min-width: 0; border: 0; padding: 0 14px; outline: 0; background: transparent; font-size: var(--text-base); }
.hero-search .btn { min-height: 42px; }
.query-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.query-chip { border: 1px solid var(--border); background: var(--surface); color: var(--muted); border-radius: var(--radius-pill); padding: 7px 11px; cursor: pointer; font-size: var(--text-xs); }
.query-chip:hover { color: var(--primary); border-color: color-mix(in oklab, var(--primary), var(--border) 60%); background: var(--primary-soft); }
.library-list, .asset-list { display: grid; }
.library-row, .asset-row { display: grid; gap: 16px; align-items: center; padding: 16px 18px; border-bottom: 1px solid var(--border); cursor: pointer; }
.library-row { grid-template-columns: minmax(260px, 1.6fr) minmax(140px, .8fr) minmax(150px, .9fr) 120px 140px; }
.library-row:last-child, .asset-row:last-child { border-bottom: 0; }
.library-row:hover, .asset-row:hover { background: var(--primary-soft); }
.row-title { display: flex; gap: 12px; align-items: flex-start; min-width: 0; }
.file-icon { width: 34px; height: 34px; flex: 0 0 auto; display: grid; place-items: center; border-radius: var(--radius-sm); background: var(--primary-soft); color: var(--primary); }
.row-title strong { display: block; font-weight: 620; margin-bottom: 3px; }
.row-title p { margin: 0; color: var(--muted); font-size: var(--text-xs); max-width: 52ch; }
.meta { color: var(--muted); font-size: var(--text-xs); }
.filterbar { display: grid; grid-template-columns: minmax(260px, 1fr) repeat(4, minmax(120px, 160px)); gap: 10px; margin-bottom: 16px; }
.split-layout { display: grid; grid-template-columns: 218px minmax(0, 1fr); gap: 20px; }
.filter-tree { padding: 12px; align-self: start; position: sticky; top: 92px; }
.tree-title { padding: 8px; font-weight: 620; }
.tree-item { min-height: 38px; border-radius: var(--radius-sm); padding: 0 10px; display: flex; align-items: center; justify-content: space-between; color: var(--muted); cursor: pointer; }
.tree-item:hover, .tree-item.active { background: var(--primary-soft); color: var(--primary); }
.knowledge-card { padding: 16px; border-bottom: 1px solid var(--border); }
.knowledge-card:last-child { border-bottom: 0; }
.knowledge-card:hover { background: var(--primary-soft); }
.knowledge-card .top { display: flex; justify-content: space-between; gap: 16px; }
.knowledge-card p { color: var(--muted); max-width: 75ch; margin: 8px 0 12px; }
.meta-line { display: flex; flex-wrap: wrap; gap: 16px; color: var(--muted); font-size: var(--text-xs); }
.notice { border: 1px solid var(--border); background: var(--surface); border-radius: var(--radius-md); padding: 16px; display: flex; gap: 12px; align-items: flex-start; }
.notice.info { background: var(--primary-soft); border-color: color-mix(in oklab, var(--primary), transparent 78%); }
.notice.warn { background: var(--warn-soft); border-color: color-mix(in oklab, var(--warn), transparent 75%); }
.notice strong { display: block; margin-bottom: 3px; }
.notice p { margin: 0; color: var(--muted); }
.search-layout { display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 20px; }
.answer { padding: 22px; }
.answer-label { display: flex; align-items: center; gap: 8px; color: var(--smart); font-weight: 630; margin-bottom: 14px; }
.answer p { font-size: var(--text-base); line-height: 1.75; margin: 0 0 14px; max-width: 72ch; }
.cite { color: var(--primary); font-family: var(--font-mono); font-size: var(--text-xs); font-weight: 600; vertical-align: super; }
.source { padding: 14px 0; border-bottom: 1px solid var(--border); }
.source:last-child { border-bottom: 0; }
.source strong { display: block; margin-bottom: 6px; }
.source p { margin: 6px 0; color: var(--muted); }
.reader-shell { height: calc(100vh - 64px); display: grid; grid-template-rows: auto minmax(0, 1fr); overflow: hidden; }
.detail-head { background: var(--surface); border-bottom: 1px solid var(--border); padding: 16px 24px; display: flex; gap: 18px; align-items: center; }
.detail-head .heading { min-width: 0; flex: 1; }
.detail-head h1 { font-size: var(--text-lg); margin-bottom: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.detail-actions { display: flex; gap: 8px; align-items: center; }
.doc-layout { min-height: 0; display: grid; grid-template-columns: 250px minmax(500px, 1fr) 330px; }
.doc-toc, .knowledge-panel { background: var(--surface); overflow: auto; }
.doc-toc { border-right: 1px solid var(--border); padding: 16px 12px; }
.knowledge-panel { border-left: 1px solid var(--border); }
.toc-section { margin: 14px 0 6px; padding: 0 8px; color: var(--muted); font-size: var(--text-xs); text-transform: uppercase; letter-spacing: .08em; }
.toc-link { width: 100%; min-height: 36px; border: 0; background: transparent; border-radius: var(--radius-sm); text-align: left; padding: 8px; color: var(--muted); cursor: pointer; }
.toc-link:hover, .toc-link.active { background: var(--primary-soft); color: var(--primary); }
.toc-link.indent { padding-left: 24px; }
.document-viewport { overflow: auto; background: var(--canvas); padding: 28px; }
.paper { width: min(760px, 100%); min-height: 980px; margin: 0 auto 28px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--elev-raised); padding: 66px 76px; }
.paper h2 { text-align: center; font-size: var(--text-2xl); margin-bottom: 16px; }
.paper .doc-meta { text-align: center; color: var(--muted); font-size: var(--text-xs); border-bottom: 1px solid var(--border); padding-bottom: 18px; margin-bottom: 30px; }
.paper h3 { margin: 26px 0 12px; }
.paper p { font-size: var(--text-base); line-height: 1.9; text-indent: 2em; margin: 0 0 12px; }
.paper mark { background: var(--primary-soft); color: var(--fg); padding: 2px 0; border-bottom: 2px solid var(--primary); }
.knowledge-panel .tabs { padding: 0 16px; gap: 16px; overflow: auto; }
.knowledge-panel .panel-content { padding: 16px; }
.summary-block { margin-bottom: 20px; }
.summary-block h3 { margin-bottom: 8px; }
.summary-block p { margin: 0; color: var(--muted); }
.fragment { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; margin-bottom: 10px; cursor: pointer; }
.fragment:hover { border-color: color-mix(in oklab, var(--primary), var(--border) 45%); background: var(--primary-soft); }
.fragment strong { font-size: var(--text-xs); }
.fragment p { color: var(--muted); margin: 7px 0; }
.media-layout { display: grid; grid-template-rows: auto auto minmax(0, 1fr); gap: 20px; }
.media-top { display: grid; grid-template-columns: minmax(600px, 1.8fr) minmax(300px, .8fr); gap: 20px; }
.player { min-height: 390px; background: var(--player); color: var(--accent-on); border-radius: var(--radius-md); display: grid; grid-template-rows: 1fr auto; overflow: hidden; box-shadow: var(--elev-raised); }
.player-stage { display: grid; place-items: center; position: relative; background: radial-gradient(circle at 42% 42%, var(--player-lift), var(--player) 62%); }
.lecture-frame { width: 62%; aspect-ratio: 16/9; background: var(--surface); color: var(--fg); padding: 30px; box-shadow: 0 18px 42px color-mix(in oklab, var(--player), transparent 35%); }
.lecture-frame small { color: var(--muted); }
.lecture-frame h2 { margin-top: 36px; font-size: var(--text-2xl); }
.lecture-frame .line { width: 62%; height: 8px; background: var(--border); margin-top: 18px; }
.player-controls { min-height: 66px; padding: 12px 16px; background: color-mix(in oklab, var(--player), var(--surface) 4%); }
.progress { height: 4px; border-radius: var(--radius-pill); background: color-mix(in oklab, var(--accent-on), transparent 78%); margin-bottom: 12px; cursor: pointer; }
.progress span { display: block; height: 100%; width: var(--progress, 36%); background: var(--smart-light); border-radius: inherit; }
.control-row { display: flex; align-items: center; gap: 12px; font-size: var(--text-xs); }
.play-btn { width: 34px; height: 34px; display: grid; place-items: center; border: 0; border-radius: 50%; background: var(--accent-on); color: var(--player); cursor: pointer; }
.time { font-family: var(--font-mono); }
.control-row .spacer { margin-left: auto; }
.overview { padding: 18px; }
.overview h2 { margin-bottom: 14px; }
.overview dl { display: grid; grid-template-columns: 80px 1fr; gap: 10px; margin: 18px 0 0; }
.overview dt { color: var(--muted); }
.overview dd { margin: 0; }
.media-content { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; }
.transcript { padding: 4px 18px; }
.transcript-row { display: grid; grid-template-columns: 72px 82px minmax(0, 1fr); gap: 14px; padding: 16px 0; border-bottom: 1px solid var(--border); cursor: pointer; }
.transcript-row:hover, .transcript-row.active { background: var(--smart-soft); margin: 0 -18px; padding-left: 18px; padding-right: 18px; }
.transcript-row.active { box-shadow: inset 3px 0 0 var(--smart); }
.speaker { font-weight: 600; }
.graph { min-height: 330px; position: relative; overflow: hidden; background-image: linear-gradient(var(--border) 1px, transparent 1px), linear-gradient(90deg, var(--border) 1px, transparent 1px); background-size: 24px 24px; }
.node { position: absolute; min-width: 84px; padding: 8px 11px; border-radius: var(--radius-pill); border: 1px solid color-mix(in oklab, var(--smart), transparent 45%); background: var(--surface); color: var(--smart); text-align: center; cursor: pointer; box-shadow: var(--elev-raised); }
.node:hover, .node.active { background: var(--smart); color: var(--accent-on); }
.node.n1 { left: 34px; top: 52px; } .node.n2 { right: 24px; top: 94px; } .node.n3 { left: 82px; top: 182px; } .node.n4 { right: 68px; top: 244px; }
.graph-line { position: absolute; height: 1px; transform-origin: left center; background: var(--smart); opacity: .45; }
.state-demo { display: none; padding: 34px; text-align: center; }
.state-demo.active { display: block; }
.state-demo h3 { margin-bottom: 8px; }
.state-switcher { display: flex; gap: 6px; }
.toast { position: fixed; right: 24px; bottom: 24px; min-width: 280px; max-width: 380px; background: var(--fg); color: var(--accent-on); border-radius: var(--radius-md); padding: 13px 16px; box-shadow: var(--elev-raised); transform: translateY(20px); opacity: 0; pointer-events: none; z-index: 100; }
.toast.show { opacity: 1; transform: translateY(0); }
.modal-backdrop { position: fixed; inset: 0; background: color-mix(in oklab, var(--fg), transparent 60%); display: none; place-items: center; z-index: 80; }
.modal-backdrop.open { display: grid; }
.modal { width: min(520px, calc(100vw - 48px)); background: var(--surface); border-radius: var(--radius-md); border: 1px solid var(--border); box-shadow: var(--elev-raised); }
.modal .modal-head { padding: 16px 18px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal .modal-body { padding: 18px; display: grid; gap: 14px; }
.modal .modal-foot { padding: 14px 18px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }
.drawer { position: fixed; top: 64px; right: 0; bottom: 0; width: 420px; background: var(--surface); border-left: 1px solid var(--border); box-shadow: var(--elev-raised); transform: translateX(102%); transition: transform var(--motion-base) var(--ease-standard); z-index: 50; padding: 20px; overflow: auto; }
.drawer.open { transform: translateX(0); }
.drawer-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.maintenance-bar { display: none; min-height: 44px; padding: 8px 16px; background: var(--warn-soft); border-bottom: 1px solid color-mix(in oklab, var(--warn), transparent 70%); align-items: center; justify-content: space-between; gap: 12px; }
.maintenance-bar.show { display: flex; }
@media (max-width: 1280px) {
  .app { grid-template-columns: 196px minmax(0, 1fr); }
  .sidebar { padding-left: 10px; padding-right: 10px; }
  .main { padding-left: 22px; padding-right: 22px; }
  .doc-layout { grid-template-columns: 220px minmax(500px, 1fr) 300px; }
  .library-row { grid-template-columns: minmax(240px, 1.5fr) minmax(130px, .8fr) 140px 110px; }
  .library-row > :nth-child(4) { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
