:root {
  color-scheme: light;
  --forest-950: #063b30;
  --forest-900: #08493a;
  --forest-800: #0d5d48;
  --forest-700: #157156;
  --forest-100: #e4f0eb;
  --ink: #17231f;
  --muted: #68746f;
  --line: #dce4e0;
  --line-strong: #c9d4cf;
  --surface: #ffffff;
  --canvas: #f4f7f5;
  --soft: #f8faf9;
  --warning: #8a5a16;
  --danger: #a34035;
  --sidebar: 284px;
  --rail: 326px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; color: var(--ink); background: var(--canvas); font-size: 14px; }
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }
.ui-icon { width: 18px; height: 18px; flex: 0 0 auto; }

.primary-button, .quiet-button, .composer-send {
  min-height: 40px; border: 1px solid var(--line-strong); border-radius: 7px; padding: 0 16px;
  background: var(--surface); font-weight: 650; cursor: pointer;
}
.primary-button, .composer-send { color: #fff; background: var(--forest-900); border-color: var(--forest-900); }
.primary-button:hover, .composer-send:hover { background: var(--forest-950); }
.quiet-button:hover { background: var(--soft); border-color: #aebdb6; }
button:disabled { opacity: .42; cursor: not-allowed; }
.text-action { border: 0; padding: 0; background: transparent; color: var(--forest-700); font-weight: 650; cursor: pointer; }

/* Shared authentication */
.auth-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(420px, 1.05fr) minmax(420px, .95fr); background: #fff; }
.auth-story { display: flex; flex-direction: column; min-height: 100vh; padding: 42px 56px; color: #fff; background: var(--forest-950); }
.lab2-brand { display: inline-flex; align-items: center; gap: 11px; min-width: 0; }
.lab2-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 8px; background: #fff; color: var(--forest-950); font-size: 20px; font-weight: 800; }
.lab2-brand span:last-child { display: grid; gap: 2px; min-width: 0; }
.lab2-brand strong { font-size: 14px; }
.lab2-brand small { font-size: 11px; opacity: .72; }
.auth-copy { margin: auto 0; max-width: 620px; }
.auth-copy > p { margin: 0 0 18px; color: #a9d4c2; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.auth-copy h1 { margin: 0 0 24px; font-size: clamp(46px, 5vw, 74px); line-height: .98; letter-spacing: -.055em; }
.auth-copy small { display: block; max-width: 520px; color: #c0d3cb; font-size: 15px; line-height: 1.8; }
.auth-links { display: flex; gap: 24px; color: #bfd3ca; }
.auth-panel { display: grid; place-items: center; padding: 36px; }
.auth-card { width: min(420px, 100%); }
.auth-card h2 { margin: 0 0 8px; font-size: 30px; letter-spacing: -.03em; }
.auth-card > p { margin: 0 0 32px; color: var(--muted); }
.auth-card .primary-button { width: 100%; margin-top: 8px; }
.auth-dev-login { width: 100%; margin-top: 10px; }
.auth-foot { margin-top: 22px; color: var(--muted); font-size: 12px; text-align: center; }
.auth-error { margin-top: 14px; padding: 11px 12px; border: 1px solid #e7b5ae; border-radius: 6px; color: var(--danger); background: #fff7f5; }

/* Application shell */
.lab2-shell { min-height: 100vh; display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); }
.lab2-sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; color: #e8f2ee; background: var(--forest-950); overflow: hidden; }
.lab2-sidebar .lab2-brand { height: 74px; min-height: 74px; padding: 0 20px; border-bottom: 1px solid rgba(255,255,255,.08); }
.lab2-sidebar .lab2-mark { width: 34px; height: 34px; border: 1px solid rgba(255,255,255,.25); border-radius: 10px; color: #fff; background: rgba(255,255,255,.1); }
.lab2-brand-copy { min-width: 0; }
.lab2-brand-copy strong, .lab2-brand-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-primary-button { width: calc(100% - 28px); margin: 16px 14px 10px; color: var(--forest-950); background: #d9eee1; border-color: transparent; }
.sidebar-primary-button:hover { color: var(--forest-950); background: #eff9f2; }
.side-static-nav { padding: 4px 10px 0; }
.side-nav-link { width: 100%; min-height: 42px; display: flex; align-items: center; gap: 10px; border: 0; border-radius: 10px; padding: 0 12px; color: #b8cbc1; background: transparent; font-weight: 650; text-align: left; cursor: pointer; }
.side-nav-link:hover { color: #fff; background: rgba(255,255,255,.07); }
.side-nav-link.is-active { color: #effff4; background: rgba(133,206,161,.14); }
.side-nav-link .ui-icon { width: 18px; height: 18px; }
.side-heading { display: flex; justify-content: space-between; margin: 17px 11px 8px; padding: 0; color: #789489; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.project-tree { flex: 1; min-height: 0; overflow-y: auto; padding: 0 8px 18px; }
.tree-row { width: 100%; min-height: 38px; display: flex; align-items: center; gap: 7px; border: 0; border-radius: 5px; padding: 5px 9px; color: #d4e4de; background: transparent; text-align: left; cursor: pointer; }
.tree-row:hover { background: rgba(255,255,255,.07); }
.tree-row.is-active { color: #fff; background: rgba(255,255,255,.13); box-shadow: inset 3px 0 #a9dc55; }
.tree-row .ui-icon { width: 15px; height: 15px; opacity: .8; }
.tree-caret { width: 12px; color: #9bbbae; }
.tree-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-row.is-experiment { padding-left: 27px; font-size: 13px; }
.tree-runs { margin: 1px 0 5px; }
.tree-runs-label { display: flex; align-items: center; gap: 7px; padding: 5px 10px 4px 46px; color: #80a799; font-size: 11px; }
.tree-runs-label .ui-icon { width: 13px; }
.tree-row.is-run { min-height: 34px; padding-left: 48px; color: #c1d4cc; font-size: 12px; }
.tree-empty { padding: 18px 10px; color: #9eb9ae; }
.side-footer { padding: 12px 14px 14px; border-top: 1px solid rgba(255,255,255,.08); }
.side-links { display: flex; align-items: center; gap: 16px; padding: 0 7px 10px; color: #9bb1a6; font-size: 12px; font-weight: 650; }
.side-links a:hover, .side-links a:focus-visible { color: #fff; outline: 0; }
.side-user { display: grid; grid-template-columns: 32px minmax(0,1fr) 28px; align-items: center; gap: 10px; padding: 9px 7px 4px; }
.side-user-avatar { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; color: var(--forest-950); background: #d9eee1; font-size: 12px; font-weight: 750; }
.side-user-copy { display: grid; gap: 2px; min-width: 0; }
.side-user-copy strong, .side-user-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-user-copy strong { font-size: 12px; }
.side-user-copy small { color: #9ab5aa; font-size: 10px; }
.side-user-logout { display: grid; place-items: center; width: 28px; height: 28px; border: 0; color: #a7c0b6; background: transparent; cursor: pointer; }
.side-user-logout:hover { color: #fff; }

.project-index-scroll { height: calc(100vh - 64px); overflow: auto; }
.project-index { width: min(920px, calc(100% - 48px)); margin: 48px auto; }
.project-index-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.project-index-head p { margin: 0 0 5px; color: var(--forest-700); font-size: 11px; font-weight: 750; letter-spacing: .1em; text-transform: uppercase; }
.project-index-head h1 { margin: 0; font-size: 30px; letter-spacing: -.035em; }
.project-index-list { display: grid; margin-top: 14px; border-top: 1px solid var(--line); }
.project-index-row { width: 100%; min-height: 86px; display: grid; grid-template-columns: minmax(0,1fr) auto 18px; align-items: center; gap: 24px; border: 0; border-bottom: 1px solid var(--line); padding: 14px 4px; background: transparent; text-align: left; cursor: pointer; }
.project-index-row:hover { background: rgba(255,255,255,.65); }
.project-index-main { min-width: 0; display: grid; gap: 5px; }
.project-index-main strong, .project-index-main small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-index-main strong { font-size: 15px; }
.project-index-main small, .project-index-meta small { color: var(--muted); font-size: 11px; }
.project-index-meta { display: flex; align-items: center; gap: 18px; }
.project-index-row > .ui-icon { width: 15px; color: var(--muted); }

.lab2-main { min-width: 0; min-height: 100vh; display: grid; grid-template-rows: 64px minmax(0, 1fr); }
.lab2-main.has-run { grid-template-rows: 64px minmax(0, 1fr); }
.lab2-topbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 0 24px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.96); }
.crumbs { min-width: 0; display: flex; align-items: center; gap: 5px; color: var(--muted); }
.crumbs span { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crumbs span:last-of-type { color: var(--ink); font-weight: 650; }
.crumbs .ui-icon { width: 14px; height: 14px; opacity: .5; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.run-status { display: inline-flex; align-items: center; gap: 6px; color: var(--forest-700); font-size: 12px; }
.run-status i { width: 6px; height: 6px; border-radius: 50%; background: #2a8b65; }
.run-status.is-frozen { color: var(--muted); }
.run-status.is-frozen i { background: #9ba6a1; }
.member-button, .icon-button { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; border: 1px solid var(--line); border-radius: 6px; padding: 0 10px; background: #fff; cursor: pointer; }
.member-button em { min-width: 18px; height: 18px; display: grid; place-items: center; border-radius: 9px; color: var(--forest-800); background: var(--forest-100); font-size: 10px; font-style: normal; }
.top-complete { min-height: 36px; }
.top-record { min-height: 36px; }
.run-panel-button .run-panel-chevron { width: 14px; transform: rotate(90deg); }
.run-panel-button .run-panel-mobile-icon { display: none; width: 15px; }
.run-panel-button.is-active { border-color: var(--forest-700); color: var(--forest-800); background: var(--forest-100); }
.mobile-menu { display: none; }
.run-tabs { display: flex; align-items: end; gap: 22px; padding: 0 24px; border-bottom: 1px solid var(--line); background: #fff; }
.run-tab { height: 42px; display: inline-flex; align-items: center; gap: 6px; border: 0; border-bottom: 2px solid transparent; color: var(--muted); background: transparent; font-weight: 650; cursor: pointer; }
.run-tab.is-active { color: var(--forest-900); border-bottom-color: var(--forest-800); }
.run-tab .count { min-width: 19px; height: 19px; display: grid; place-items: center; border-radius: 10px; background: var(--forest-100); font-size: 10px; }

.workspace { position: relative; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr); overflow: hidden; }
.workspace.no-rail { grid-template-columns: minmax(0, 1fr); }
.workspace-center { min-width: 0; min-height: 0; background: var(--canvas); }
.workspace-center.is-timeline { height: calc(100vh - 64px); display: grid; grid-template-rows: minmax(0, 1fr) auto; overflow: hidden; }
.workspace-scroll { height: calc(100vh - 64px); overflow: auto; }
.workspace-center.is-timeline .workspace-scroll { height: auto; }
.notebook { width: min(1120px, calc(100% - 48px)); min-height: calc(100vh - 108px); margin: 22px auto 42px; padding: 0 30px 28px; border: 1px solid var(--line); background: #fff; }
.experiment-plan { margin: 0 -30px; border-bottom: 1px solid var(--line); background: var(--soft); }
.experiment-plan summary { display: flex; justify-content: space-between; padding: 16px 22px; font-weight: 700; cursor: pointer; list-style: none; }
.experiment-plan summary::-webkit-details-marker { display: none; }
.experiment-plan summary span { color: var(--muted); font-size: 11px; font-weight: 500; }
.experiment-plan dl { display: grid; gap: 8px; margin: 0; padding: 0 22px 17px; }
.experiment-plan dl div { display: grid; grid-template-columns: 48px minmax(0,1fr); gap: 12px; }
.experiment-plan dt { color: var(--muted); }
.experiment-plan dd { margin: 0; line-height: 1.55; }
.notebook-day { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding: 26px 2px 12px; border-bottom: 1px solid var(--line-strong); }
.notebook-day h1 { margin: 0; font-size: 22px; letter-spacing: -.025em; }
.notebook-day span { color: var(--muted); font-size: 12px; }
.notebook-events { position: relative; padding: 6px 0 0; }
.notebook-events::before { content: ""; position: absolute; top: 7px; bottom: 0; left: 70px; width: 1px; background: var(--line); }
.notebook-event { position: relative; display: grid; grid-template-columns: 58px 14px minmax(0, 1fr); gap: 8px; padding: 19px 0 18px; }
.notebook-event + .notebook-event { border-top: 1px solid #edf1ef; }
.notebook-time { display: grid; align-content: start; gap: 2px; padding-top: 2px; color: #4f5c56; font-variant-numeric: tabular-nums; }
.notebook-time small { color: #8a9590; font-size: 9px; line-height: 1.2; white-space: nowrap; }
.notebook-dot { z-index: 1; width: 8px; height: 8px; margin: 6px 0 0 3px; border: 2px solid #fff; border-radius: 50%; background: var(--forest-800); box-shadow: 0 0 0 1px var(--forest-800); }
.notebook-entry { min-width: 0; padding-left: 7px; }
.notebook-entry-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 6px; }
.notebook-entry-head > div { display: flex; align-items: baseline; gap: 10px; }
.notebook-entry-head strong { font-size: 14px; }
.notebook-entry-head span { color: var(--muted); font-size: 11px; }
.entry-actions { display: flex; align-items: center; gap: 14px; opacity: .55; transition: opacity .15s ease; }
.notebook-entry:hover .entry-actions, .notebook-entry:focus-within .entry-actions { opacity: 1; }
.entry-actions button { border: 0; padding: 0; color: #4f5c56; background: transparent; font-size: 11px; cursor: pointer; }
.entry-actions button:hover { color: var(--forest-800); }
.entry-actions-menu { display: none; position: relative; }
.entry-actions-menu summary { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 4px; color: var(--muted); cursor: pointer; list-style: none; }
.entry-actions-menu summary::-webkit-details-marker { display: none; }
.entry-actions-menu summary .ui-icon { width: 17px; }
.entry-actions-menu > div { position: absolute; z-index: 8; top: 30px; right: 0; min-width: 116px; display: grid; padding: 5px; border: 1px solid var(--line); border-radius: 6px; background: #fff; box-shadow: 0 12px 32px rgba(5,41,31,.15); }
.entry-actions-menu > div button { min-height: 34px; padding: 0 10px; text-align: left; }
.entry-relation { display: inline-flex; margin: 0 0 7px; border: 0; border-left: 2px solid #86b79e; padding: 2px 0 2px 8px; color: var(--forest-700); background: transparent; font-size: 11px; cursor: pointer; }
.notebook-event.is-highlighted .notebook-entry { background: #f1f8f4; outline: 6px solid #f1f8f4; }
.entry-body { color: #27342f; font-size: 14px; line-height: 1.7; overflow-wrap: anywhere; }
.entry-body p { margin: 0 0 6px; }
.entry-body p:last-child { margin-bottom: 0; }
.record-list, .record-check { display: flex; gap: 8px; }
.record-list p, .record-check p { margin: 0; }
.record-check > span { width: 17px; height: 17px; margin-top: 3px; display: grid; place-items: center; border: 1px solid var(--line-strong); border-radius: 3px; color: var(--forest-800); font-size: 10px; }
.record-space { height: 8px; }
.entry-foot { margin-top: 6px; }
.entry-organizing, .entry-organized summary { color: #7a8781; font-size: 11px; }
.entry-organizing.is-error { border: 0; padding: 0; color: var(--danger); background: transparent; cursor: pointer; }
.entry-organized { display: inline-block; }
.entry-organized summary { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; list-style: none; }
.entry-organized summary::-webkit-details-marker { display: none; }
.entry-organized summary .ui-icon { width: 13px; height: 13px; }
.entry-organized > div { width: min(520px, 70vw); margin-top: 7px; padding: 10px 12px; border: 1px solid var(--line); background: var(--soft); }
.entry-organized p { margin: 0 0 8px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.organization-fallback { position: relative; display: inline-flex; align-items: center; gap: 10px; }
.entry-organized.is-manual > div { width: auto; position: absolute; z-index: 4; padding: 8px; box-shadow: 0 10px 30px rgba(5,41,31,.12); }
.section-options { display: flex; flex-wrap: wrap; gap: 5px; }
.section-option { border: 1px solid var(--line); border-radius: 4px; padding: 4px 7px; color: var(--forest-800); background: #fff; font-size: 11px; cursor: pointer; }
.notebook-question { margin-top: 10px; padding: 9px 11px; border-left: 2px solid #d7a85e; background: #fffaf2; }
.notebook-question strong { color: var(--warning); font-size: 11px; }
.notebook-question p { margin: 3px 0 6px; line-height: 1.5; }
.notebook-question div { display: flex; gap: 14px; }
.file-event { align-items: center; }
.file-row { min-width: 0; display: grid; grid-template-columns: 42px minmax(0,1fr) auto; align-items: center; gap: 11px; margin-left: 7px; padding: 10px 11px; border: 1px solid var(--line); background: var(--soft); }
.entry-files { display: grid; gap: 6px; margin-top: 10px; }
.file-row.is-nested { width: min(560px, 100%); margin-left: 0; background: #fbfcfb; }
.entry-addendum { margin-top: 12px; border-left: 3px solid #8bc3a6; padding: 8px 11px; background: #f5faf7; }
.entry-addendum strong { display: block; color: var(--forest-800); font-size: 11px; }
.entry-addendum p { margin: 5px 0 3px; line-height: 1.55; }
.entry-addendum small { color: var(--muted); }
.file-icon { display: grid; place-items: center; width: 42px; height: 38px; border: 1px solid #c9ded4; color: var(--forest-800); background: #edf6f2; font-size: 9px; font-weight: 800; }
.file-copy { display: grid; gap: 3px; min-width: 0; }
.file-copy strong, .file-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-copy small { color: var(--muted); font-size: 10px; }
.file-open { min-height: 30px; border: 0; padding: 0 8px; color: var(--forest-700); background: transparent; font-weight: 650; cursor: pointer; }
.notebook-empty { margin: 32px 0 22px 82px; padding: 20px; border: 1px dashed var(--line-strong); color: var(--muted); }
.notebook-empty strong { color: var(--ink); }
.notebook-empty p { margin: 5px 0 0; }

.notebook-composer { z-index: 6; width: min(1120px, calc(100% - 48px)); margin: 0 auto 12px; border: 1px solid #aebfb7; border-radius: 7px; background: #fff; }
.notebook-composer:focus-within { border-color: var(--forest-700); box-shadow: 0 0 0 2px rgba(21,113,86,.08); }
.notebook-composer.is-dragging { border-color: var(--forest-700); background: #f0f8f4; box-shadow: 0 0 0 4px rgba(21,113,86,.12); }
.composer textarea { width: 100%; min-height: 76px; max-height: 220px; display: block; resize: vertical; border: 0; padding: 14px 16px 10px; color: var(--ink); background: transparent; line-height: 1.6; outline: 0; }
.composer textarea::placeholder { color: #98a29e; }
.composer-relation { min-height: 34px; display: flex; align-items: center; justify-content: space-between; padding: 0 12px 0 15px; border-bottom: 1px solid var(--line); color: var(--forest-800); background: #f4f9f6; font-size: 11px; }
.composer-relation button { width: 26px; height: 26px; display: grid; place-items: center; border: 0; padding: 0; color: var(--muted); background: transparent; cursor: pointer; }
.composer-relation .ui-icon { width: 14px; }
.composer-tools { min-height: 46px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 6px 8px 6px 10px; border-top: 1px solid var(--line); }
.insert-tools, .composer-submit { display: flex; align-items: center; gap: 5px; }
.insert-tools button { min-height: 31px; display: inline-flex; align-items: center; gap: 5px; border: 0; padding: 0 7px; color: #596660; background: transparent; font-size: 12px; cursor: pointer; }
.insert-tools button:hover { color: var(--forest-800); background: var(--soft); }
.insert-tools .ui-icon { width: 16px; height: 16px; }
.insert-tools .occurrence-button { color: #6e7a75; }
.insert-tools .occurrence-button.is-detected { color: var(--forest-700); background: var(--forest-100); }
.composer-submit > span { margin-right: 6px; color: #89938f; font-size: 10px; }
.composer-send { min-height: 36px; }
.upload-progress { margin: 0 14px 8px; padding: 8px 10px; color: var(--forest-800); background: var(--forest-100); font-size: 11px; }

.run-panel-backdrop { position: fixed; z-index: 29; inset: 64px 0 0 var(--sidebar); border: 0; background: rgba(11,28,22,.12); cursor: default; }
.workspace-rail { position: fixed; z-index: 30; top: 64px; right: 0; bottom: 0; width: min(380px, calc(100vw - var(--sidebar))); overflow-y: auto; border-left: 1px solid var(--line); background: #fbfcfb; box-shadow: -18px 0 45px rgba(5,41,31,.09); transform: translateX(102%); transition: transform .18s ease; }
.workspace-rail.is-open { transform: translateX(0); }
.rail-section { padding: 22px 24px; border-bottom: 1px solid var(--line); }
.rail-summary header { display: flex; justify-content: space-between; gap: 10px; }
.rail-head-actions { display: flex; align-items: center; gap: 7px; }
.rail-close { width: 28px; height: 28px; display: grid; place-items: center; border: 0; padding: 0; color: var(--muted); background: transparent; cursor: pointer; }
.rail-close .ui-icon { width: 16px; }
.rail-summary h2 { margin: 0 0 4px; font-size: 16px; }
.rail-summary header p { margin: 0; color: var(--muted); font-size: 11px; }
.rail-state { height: 24px; padding: 4px 7px; border: 1px solid var(--line); border-radius: 4px; color: var(--muted); font-size: 10px; }
.organized-facts { margin: 18px 0 0; }
.organized-facts > div { padding: 13px 0; border-top: 1px solid var(--line); }
.organized-facts dt { margin-bottom: 5px; color: #3f4d47; font-weight: 700; }
.organized-facts dd { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.rail-readiness, .rail-check { background: #fff; }
.rail-readiness strong, .rail-check strong { display: block; margin-bottom: 5px; font-size: 12px; }
.rail-readiness p, .rail-check p { margin: 0 0 8px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.rail-check { border-left: 3px solid #d6a458; }
.rail-actions { display: grid; gap: 9px; }
.rail-link { min-height: 42px; display: flex; align-items: center; justify-content: space-between; border: 0; border-bottom: 1px solid var(--line); padding: 0; background: transparent; text-align: left; font-weight: 650; cursor: pointer; }
.rail-link small { margin-left: 5px; color: var(--muted); font-weight: 500; }
.rail-link .ui-icon { width: 15px; }
.rail-full { width: 100%; }
.rail-new-experiment { justify-self: center; margin-top: 4px; }
.frozen-copy { margin: 0; padding: 10px; color: var(--muted); background: var(--soft); text-align: center; font-size: 11px; }

/* Project continuity */
.project-scroll { height: calc(100vh - 64px); }
.project-overview { width: min(1040px, calc(100% - 52px)); margin: 34px auto 60px; }
.project-overview-head { display: flex; align-items: start; justify-content: space-between; gap: 30px; padding: 0 0 28px; border-bottom: 1px solid var(--line-strong); }
.project-overview-head > div { max-width: 780px; }
.project-overview-head > div > p { margin: 0 0 8px; color: var(--forest-700); font-size: 11px; font-weight: 750; letter-spacing: .1em; text-transform: uppercase; }
.project-overview-head h1 { margin: 0 0 12px; font-size: clamp(30px, 4vw, 48px); letter-spacing: -.045em; }
.project-goal { color: #45524c; font-size: 15px; line-height: 1.7; }
.project-state, .project-experiments, .project-quick-start { margin-top: 24px; border: 1px solid var(--line); background: #fff; }
.project-state > header, .project-experiments > header { min-height: 54px; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 0 20px; border-bottom: 1px solid var(--line); }
.project-state > header > div { display: flex; align-items: baseline; gap: 10px; }
.project-state > header span, .project-experiments h2 { margin: 0; font-size: 14px; font-weight: 750; }
.project-state > header small, .project-experiments > header > span { color: var(--muted); font-size: 11px; }
.project-state-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); }
.project-state-grid > div { min-width: 0; padding: 20px; }
.project-state-grid > div + div { border-left: 1px solid var(--line); }
.project-state-grid small, .project-decision small { color: var(--muted); font-size: 11px; font-weight: 700; }
.project-state-grid p, .project-decision p { margin: 7px 0 0; line-height: 1.65; white-space: pre-wrap; }
.project-decision { padding: 15px 20px; border-top: 1px solid var(--line); background: var(--soft); }
.project-source { min-height: 40px; display: flex; align-items: center; gap: 6px; border: 0; border-top: 1px solid var(--line); padding: 0 20px; color: var(--forest-700); background: #fff; font-size: 11px; cursor: pointer; }
.project-source .ui-icon { width: 13px; height: 13px; }
.project-state-empty, .project-list-empty { padding: 25px 20px; color: var(--muted); }
.experiment-row { width: 100%; min-height: 66px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border: 0; border-bottom: 1px solid var(--line); padding: 12px 20px; background: #fff; text-align: left; cursor: pointer; }
.experiment-row:last-child { border-bottom: 0; }
.experiment-row:hover { background: var(--soft); }
.experiment-row > span { min-width: 0; display: grid; gap: 5px; }
.experiment-row strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.experiment-row small { color: var(--muted); }
.experiment-row .ui-icon { width: 16px; color: var(--muted); }
.project-quick-start { border-color: var(--line-strong); }
.project-quick-start textarea { width: 100%; min-height: 112px; display: block; resize: vertical; border: 0; padding: 17px 18px; background: transparent; line-height: 1.65; outline: 0; }
.project-quick-start > div { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 8px 10px 8px 18px; border-top: 1px solid var(--line); }
.project-quick-start > div span { color: var(--muted); font-size: 11px; }

/* Experiment continuity and cross-Run comparison */
.experiment-scroll { height: calc(100vh - 64px); }
.experiment-overview { width: min(1040px, calc(100% - 52px)); margin: 34px auto 60px; }
.experiment-overview-head { display: flex; align-items: start; justify-content: space-between; gap: 28px; padding-bottom: 28px; border-bottom: 1px solid var(--line-strong); }
.experiment-overview-head > div { max-width: 780px; }
.experiment-overview-head p { margin: 0 0 8px; color: var(--forest-700); font-size: 11px; font-weight: 700; }
.experiment-overview-head h1 { margin: 0 0 12px; font-size: clamp(28px, 3.5vw, 44px); letter-spacing: -.04em; }
.experiment-question { color: #45524c; font-size: 15px; line-height: 1.7; }
.experiment-brief, .experiment-conclusion, .experiment-runs { margin-top: 22px; border: 1px solid var(--line); background: #fff; }
.experiment-brief summary { display: flex; justify-content: space-between; padding: 16px 20px; font-weight: 700; cursor: pointer; list-style: none; }
.experiment-brief summary::-webkit-details-marker { display: none; }
.experiment-brief summary span { color: var(--muted); font-size: 11px; font-weight: 500; }
.experiment-brief dl { display: grid; gap: 12px; margin: 0; padding: 0 20px 18px; }
.experiment-brief dl div { display: grid; grid-template-columns: 52px minmax(0,1fr); gap: 12px; }
.experiment-brief dt { color: var(--muted); }
.experiment-brief dd { margin: 0; line-height: 1.65; }
.experiment-conclusion { padding: 18px 20px; }
.experiment-conclusion header, .experiment-runs > header { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.experiment-conclusion header span { color: var(--muted); font-size: 11px; }
.experiment-conclusion p { margin: 12px 0 0; line-height: 1.7; }
.experiment-runs > header { min-height: 54px; padding: 0 20px; border-bottom: 1px solid var(--line); }
.experiment-runs h2 { margin: 0; font-size: 14px; }
.experiment-runs > header > div { display: flex; align-items: center; gap: 18px; }
.experiment-runs > header span { color: var(--muted); font-size: 11px; }
.run-row { width: 100%; min-height: 70px; display: grid; grid-template-columns: minmax(0,1fr) auto 18px; align-items: center; gap: 14px; border: 0; border-bottom: 1px solid var(--line); padding: 12px 20px; background: #fff; text-align: left; cursor: pointer; }
.run-row:last-child { border-bottom: 0; }
.run-row:hover { background: var(--soft); }
.run-row > span { min-width: 0; display: grid; gap: 5px; }
.run-row small { overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.run-row em { color: var(--muted); font-size: 11px; font-style: normal; }
.run-row em.is-completed { color: var(--forest-700); }
.run-row em.is-failed, .run-row em.is-aborted { color: var(--danger); }
.run-row .ui-icon { width: 15px; color: var(--muted); }
.conclude-experiment { margin-top: 16px; }

.comparison-scroll { height: calc(100vh - 64px); }
.comparison-page { width: min(1280px, calc(100% - 52px)); margin: 24px auto 54px; }
.comparison-head { display: flex; align-items: start; justify-content: space-between; gap: 24px; margin-bottom: 18px; }
.comparison-head h1 { margin: 0 0 9px; font-size: 27px; letter-spacing: -.03em; }
.comparison-warning { margin-bottom: 12px; border-left: 3px solid #b8831f; padding: 10px 13px; color: #654b19; background: #fff9e9; font-size: 13px; }
.comparison-table-wrap { overflow-x: auto; border: 1px solid var(--line-strong); background: #fff; }
.comparison-table { width: 100%; min-width: 940px; border-collapse: collapse; table-layout: fixed; }
.comparison-table th, .comparison-table td { vertical-align: top; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 14px 16px; line-height: 1.6; text-align: left; overflow-wrap: anywhere; }
.comparison-table th:first-child { width: 150px; color: #34433d; }
.comparison-table tr:last-child > * { border-bottom: 0; }
.comparison-table tr > *:last-child { border-right: 0; }
.comparison-table thead th { background: #fbfcfb; }
.comparison-table thead button { display: block; border: 0; padding: 0; color: var(--forest-800); background: transparent; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.comparison-table thead small { display: block; margin-top: 3px; color: var(--muted); font-weight: 500; }
.comparison-table thead small.is-completed { color: var(--forest-700); }
.comparison-table thead small.is-failed, .comparison-table thead small.is-aborted { color: var(--danger); }
.comparison-table tbody th { background: #fbfcfb; }
.comparison-table tbody tr:nth-child(3) td:not(:empty), .comparison-table tbody tr:nth-child(4) td:not(:empty) { background: #f7faf8; }
.cross-run-summary { margin-top: 14px; border: 1px solid var(--line); background: #fff; }
.cross-run-summary header { min-height: 54px; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 0 18px; border-bottom: 1px solid var(--line); }
.cross-run-summary h2 { margin: 0; font-size: 14px; }
.cross-run-summary ul { margin: 0; padding: 16px 38px 8px; line-height: 1.75; }
.cross-run-summary > small { display: block; padding: 10px 18px; border-top: 1px solid var(--line); color: var(--muted); }

/* Organized document */
.document { width: min(920px, calc(100% - 44px)); margin: 22px auto 48px; border: 1px solid var(--line); background: #fff; }
.document-header { min-height: 102px; display: flex; align-items: center; justify-content: space-between; gap: 22px; padding: 24px 32px; border-bottom: 1px solid var(--line); }
.document-header h1 { margin: 0 0 8px; font-size: 24px; letter-spacing: -.025em; }
.document-project-action { flex: 0 0 auto; min-height: 36px; }
.document-meta { display: flex; gap: 16px; color: var(--muted); font-size: 11px; }
.document-layout { display: grid; grid-template-columns: 178px minmax(0,1fr); }
.document-toc { position: sticky; top: 0; align-self: start; display: grid; padding: 22px 18px; }
.document-toc a { padding: 8px 10px; border-left: 2px solid transparent; color: var(--muted); font-size: 11px; }
.document-toc a.is-active { color: var(--forest-800); border-left-color: var(--forest-800); background: var(--soft); }
.document-body { padding: 12px 34px 42px; border-left: 1px solid var(--line); }
.doc-section { padding: 24px 0; border-bottom: 1px solid var(--line); }
.doc-section h2 { margin: 0 0 12px; font-size: 16px; }
.doc-section > p, .doc-source p { line-height: 1.7; }
.doc-empty { color: #98a29e; }
.doc-source { margin: 8px 0; padding: 10px 12px; background: var(--soft); }
.doc-source p { margin: 0; }
.doc-source small { display: inline-flex; align-items: center; gap: 4px; margin-top: 6px; color: var(--muted); }
.doc-source .ui-icon { width: 12px; height: 12px; }
.doc-file-list { display: grid; gap: 7px; }
.doc-file { display: flex; justify-content: space-between; border: 1px solid var(--line); padding: 10px 12px; background: #fff; cursor: pointer; }
.doc-file small { margin-left: 7px; color: var(--muted); font-weight: 500; }
.document-addenda { display: grid; gap: 8px; }
.document-addenda article { border-left: 3px solid #8bc3a6; padding: 10px 12px; background: var(--soft); }
.document-addenda p { margin: 6px 0 4px; line-height: 1.6; }
.document-addenda small { color: var(--muted); }

/* Empty and capture states */
.empty-stage, .quick-capture { width: min(700px, calc(100% - 40px)); margin: 16vh auto 0; }
.empty-stage h1, .quick-capture h1 { margin: 0 0 10px; font-size: 38px; letter-spacing: -.04em; }
.empty-stage p, .quick-capture > p { color: var(--muted); line-height: 1.6; }
.start-actions { display: flex; gap: 10px; margin-top: 22px; }
.quick-context { margin: 0 0 8px; color: var(--forest-700) !important; font-weight: 700; }
.quick-composer { margin-top: 24px; border: 1px solid var(--line-strong); background: #fff; }
.quick-composer textarea { width: 100%; min-height: 190px; display: block; resize: vertical; border: 0; padding: 17px; outline: 0; }
.quick-composer > div { display: flex; align-items: center; justify-content: space-between; padding: 10px; border-top: 1px solid var(--line); }
.quick-composer > div span { color: var(--muted); font-size: 11px; }
.quick-secondary-actions { display: flex; flex-wrap: wrap; gap: 10px 18px; margin-top: 16px; }

/* Dialogs */
.dialog-backdrop { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 24px; background: rgba(14,28,23,.45); }
.dialog { width: min(540px, 100%); max-height: min(820px, calc(100vh - 48px)); display: flex; flex-direction: column; border: 1px solid rgba(8,73,58,.2); border-radius: 12px; background: #fff; box-shadow: 0 24px 80px rgba(4,25,18,.2); overflow: hidden; }
.dialog.is-wide { width: min(760px, 100%); }
.dialog-header { display: flex; justify-content: space-between; gap: 18px; padding: 22px 24px 16px; border-bottom: 1px solid var(--line); }
.dialog-header h2 { margin: 0; font-size: 21px; letter-spacing: -.02em; }
.dialog-header p { margin: 6px 0 0; color: var(--muted); font-size: 12px; }
.dialog-close { width: 30px; height: 30px; border: 0; color: var(--muted); background: transparent; font-size: 22px; cursor: pointer; }
.dialog-body { overflow-y: auto; padding: 20px 24px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; padding: 14px 24px; border-top: 1px solid var(--line); background: var(--soft); }
.field { display: grid; gap: 7px; margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }
.field label { font-size: 12px; font-weight: 700; }
.field label small { color: var(--muted); font-weight: 500; }
.field input, .field textarea, .field select { width: 100%; border: 1px solid var(--line-strong); border-radius: 6px; padding: 10px 11px; color: var(--ink); background: #fff; outline: 0; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--forest-700); box-shadow: 0 0 0 3px rgba(21,113,86,.09); }
.field textarea { min-height: 105px; resize: vertical; line-height: 1.55; }
.advanced-fields { margin-top: 6px; border-top: 1px solid var(--line); }
.advanced-fields summary { padding: 13px 0; color: var(--forest-700); cursor: pointer; }
.draft-preserved, .example-card { margin-bottom: 17px; padding: 12px; border: 1px solid var(--line); background: var(--soft); }
.draft-preserved p { margin: 5px 0 0; color: var(--muted); }
.lab2-guide { display: grid; grid-template-columns: 176px minmax(0, 1fr); min-height: 390px; margin: -20px -24px; }
.lab2-guide-tabs { display: grid; align-content: start; gap: 5px; padding: 18px 12px; border-right: 1px solid var(--line); background: var(--soft); }
.lab2-guide-tab { width: 100%; min-height: 44px; display: flex; align-items: center; gap: 9px; border: 1px solid transparent; border-radius: 6px; padding: 0 11px; color: var(--muted); background: transparent; text-align: left; cursor: pointer; }
.lab2-guide-tab:hover { color: var(--forest-900); background: #fff; }
.lab2-guide-tab.is-selected { border-color: var(--line); color: var(--forest-900); background: #fff; font-weight: 700; box-shadow: 0 3px 12px rgba(8,73,58,.06); }
.lab2-guide-tab .ui-icon { width: 16px; height: 16px; }
.lab2-guide-panel { min-width: 0; padding: 24px 26px 28px; outline: 0; }
.lab2-guide-intro { margin: 0 0 20px; color: var(--muted); line-height: 1.65; }
.lab2-guide-items { display: grid; gap: 12px; }
.lab2-guide-item { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 11px; padding: 13px 14px; border: 1px solid var(--line); background: #fff; }
.lab2-guide-item.is-example { border-left: 3px solid #78aa90; background: var(--soft); }
.lab2-guide-step { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; color: var(--forest-800); background: var(--forest-100); font-size: 11px; font-weight: 750; }
.lab2-guide-item strong { display: block; margin-top: 3px; }
.lab2-guide-item p { margin: 5px 0 0; color: var(--muted); line-height: 1.65; overflow-wrap: anywhere; }
.lab2-guide-progress { margin-right: auto; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.lab2-guide-feedback { flex: 0 0 auto !important; }
.lab2-guide-actions { display: flex; gap: 9px; margin-left: auto; }
.member-list { display: grid; gap: 8px; }
.member-row { display: grid; grid-template-columns: 34px minmax(0,1fr) auto; align-items: center; gap: 10px; padding: 9px; border: 1px solid var(--line); }
.member-avatar { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--forest-100); color: var(--forest-800); font-weight: 750; }
.member-row div { display: grid; gap: 2px; }
.member-row small { color: var(--muted); }
.member-row em { color: var(--muted); font-size: 11px; font-style: normal; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
.completion-grid { display: grid; grid-template-columns: repeat(2, 1fr); border: 1px solid var(--line); }
.completion-grid > div { padding: 15px 17px; }
.completion-grid > div:nth-child(odd) { border-right: 1px solid var(--line); }
.completion-grid > div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
.completion-grid span { display: block; margin-bottom: 6px; color: var(--muted); font-size: 11px; }
.completion-grid strong { color: var(--forest-900); font-size: 24px; }
.completion-grid small { margin-left: 3px; color: var(--muted); }
.completion-warning { display: grid; grid-template-columns: auto minmax(0,1fr); gap: 10px; margin-top: 12px; padding: 10px 11px; border: 1px solid #ead4aa; color: var(--warning); background: #fffaf1; font-size: 11px; }
.completion-warning.is-blocking { border-color: #e5b8b2; color: var(--danger); background: #fff7f5; }
#complete-form { margin-top: 18px; }
.outcome-options { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 8px; margin: 0 0 16px; border: 0; padding: 0; }
.outcome-options legend { margin-bottom: 8px; font-size: 12px; font-weight: 750; }
.outcome-options label { position: relative; min-width: 0; cursor: pointer; }
.outcome-options input { position: absolute; opacity: 0; pointer-events: none; }
.outcome-options label > span { min-height: 48px; display: grid; place-items: center; align-content: center; gap: 4px; border: 1px solid var(--line-strong); border-radius: 6px; padding: 10px 11px; background: #fff; }
.outcome-options label > span strong { font-size: 12px; }
.outcome-options label > span small { color: var(--muted); font-size: 10px; line-height: 1.4; }
.outcome-options input:checked + span { border-color: var(--forest-700); background: var(--forest-100); box-shadow: inset 0 0 0 1px var(--forest-700); }
.outcome-note textarea { min-height: 86px; }
.completion-facts { display: flex; align-items: center; gap: 0; margin: 4px 0 16px; color: #405049; }
.completion-facts span { padding: 0 20px; border-right: 1px solid var(--line); }
.completion-facts span:first-child { padding-left: 0; }
.completion-facts span:last-child { border-right: 0; }
.project-draft { margin-top: 16px; border: 1px solid var(--line); background: #fbfcfb; }
.project-draft > header { min-height: 48px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 15px; border-bottom: 1px solid var(--line); }
.project-draft > header label { display: flex; align-items: center; gap: 8px; font-weight: 700; cursor: pointer; }
.project-draft > header small, .project-draft > small { color: var(--muted); font-size: 10px; }
.project-draft-fields { display: grid; gap: 9px; padding: 13px 15px; transition: opacity .15s ease; }
.project-draft-fields.is-disabled { opacity: .42; }
.project-draft-fields > label { display: grid; grid-template-columns: 72px minmax(0,1fr); align-items: start; gap: 10px; }
.project-draft-fields > label > span { padding-top: 9px; color: #45534d; font-size: 11px; font-weight: 700; }
.project-draft-fields textarea { min-height: 50px; resize: vertical; border: 1px solid var(--line); border-radius: 5px; padding: 8px 10px; color: var(--ink); background: #fff; line-height: 1.5; outline: 0; }
.project-draft-fields textarea:focus { border-color: var(--forest-700); box-shadow: 0 0 0 2px rgba(21,113,86,.08); }
.project-draft > small { display: block; padding: 0 15px 13px; }
.completion-time { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 15px; color: var(--muted); font-size: 11px; }
.completion-time input { border: 0; padding: 7px 0; color: #4d5954; background: transparent; text-align: right; }
.confidence-options, .evidence-options { display: flex; gap: 8px; margin: 0 0 16px; border: 0; padding: 0; }
.confidence-options legend, .evidence-options legend { width: 100%; margin-bottom: 8px; font-size: 12px; font-weight: 700; }
.confidence-options label, .evidence-options label { position: relative; cursor: pointer; }
.confidence-options input, .evidence-options input { position: absolute; opacity: 0; }
.confidence-options span, .evidence-options span { min-width: 72px; min-height: 38px; display: grid; place-items: center; border: 1px solid var(--line-strong); border-radius: 6px; background: #fff; }
.confidence-options input:checked + span, .evidence-options input:checked + span { border-color: var(--forest-700); color: var(--forest-800); background: var(--forest-100); box-shadow: inset 0 0 0 1px var(--forest-700); }
.form-source { display: block; color: var(--muted); line-height: 1.5; }
.correction-target { margin-bottom: 16px; border-left: 3px solid #8bbca4; padding: 9px 12px; background: var(--soft); }
.correction-target time { color: var(--forest-700); font-size: 10px; }
.correction-target p { margin: 5px 0 0; line-height: 1.55; }
[hidden] { display: none !important; }
.file-preview { display: grid; gap: 10px; }
.file-preview img { display: block; max-width: 100%; max-height: 62vh; margin: auto; object-fit: contain; background: var(--soft); }
.file-preview small { color: var(--muted); text-align: center; }

.toast { position: fixed; z-index: 80; right: 22px; bottom: 22px; max-width: 420px; padding: 11px 14px; border: 1px solid #bcd3c8; border-radius: 6px; color: var(--forest-950); background: #f3faf6; box-shadow: 0 14px 40px rgba(5,41,31,.14); }
.toast.is-error { border-color: #e0b0aa; color: var(--danger); background: #fff7f5; }

@media (max-width: 1120px) {
  :root { --sidebar: 250px; --rail: 290px; }
  .notebook { width: calc(100% - 30px); padding-left: 22px; padding-right: 22px; }
  .notebook-composer { width: calc(100% - 30px); }
  .experiment-plan { margin-left: -22px; margin-right: -22px; }
  .composer-submit > span { display: none; }
}

@media (max-width: 860px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-story { min-height: 280px; padding: 30px; }
  .auth-copy { margin: 55px 0 35px; }
  .auth-copy h1 { font-size: 46px; }
  .auth-panel { padding: 42px 24px; }
  .lab2-shell { grid-template-columns: 1fr; }
  .lab2-sidebar { position: fixed; z-index: 40; inset: 0 auto 0 0; width: min(300px, 86vw); transform: translateX(-101%); transition: transform .18s ease; box-shadow: 20px 0 60px rgba(0,0,0,.18); }
  .lab2-shell.is-nav-open .lab2-sidebar { transform: translateX(0); }
  .lab2-main { grid-template-rows: 58px minmax(0,1fr); }
  .lab2-main.has-run { grid-template-rows: 58px minmax(0,1fr); }
  .lab2-topbar { padding: 0 14px; }
  .mobile-menu { display: inline-grid; place-items: center; padding: 0; width: 36px; }
  .crumbs { flex: 1; }
  .crumbs span:not(:last-of-type), .crumbs .ui-icon { display: none; }
  .member-button span, .member-button em, .run-status { display: none; }
  .run-panel-button .run-panel-mobile-icon { display: block; }
  .run-panel-button .run-panel-chevron { display: none; }
  .top-complete { padding: 0 11px; }
  .run-tabs { padding: 0 16px; }
  .workspace { grid-template-columns: 1fr; overflow: auto; }
  .workspace-center.is-timeline { height: calc(100vh - 58px); }
  .workspace-scroll { height: auto; min-height: calc(100vh - 58px); overflow: visible; }
  .workspace-center.is-timeline .workspace-scroll { min-height: 0; overflow: auto; }
  .run-panel-backdrop { inset: 58px 0 0 0; }
  .workspace-rail { top: 58px; bottom: 0; width: min(380px, 100vw); height: auto; border: 0; border-left: 1px solid var(--line); margin: 0; }
  .notebook, .document { width: calc(100% - 30px); margin-top: 15px; }
  .project-scroll { height: calc(100vh - 58px); min-height: 0; overflow: auto; }
  .project-overview { width: calc(100% - 30px); margin-top: 24px; }
  .project-index-scroll { height: calc(100vh - 58px); min-height: 0; overflow: auto; }
  .project-index { width: calc(100% - 30px); margin-top: 24px; }
  .experiment-scroll, .comparison-scroll { height: calc(100vh - 58px); min-height: 0; overflow: auto; }
  .experiment-overview, .comparison-page { width: calc(100% - 30px); margin-top: 24px; }
}

@media (max-width: 520px) {
  body { font-size: 13px; }
  .top-complete { font-size: 11px; }
  .member-button:not(.run-panel-button) { display: none; }
  .project-index-head { align-items: center; }
  .project-index-head h1 { font-size: 24px; }
  .project-index-row { grid-template-columns: minmax(0,1fr) 16px; gap: 10px; }
  .project-index-meta { display: none; }
  .run-panel-button { width: 36px; padding: 0; justify-content: center; }
  .notebook { padding: 0 15px 18px; }
  .experiment-plan { margin-left: -15px; margin-right: -15px; }
  .experiment-plan dl div { grid-template-columns: 38px minmax(0,1fr); }
  .notebook-day { padding-top: 20px; }
  .notebook-day h1 { font-size: 19px; }
  .notebook-events::before { left: 61px; }
  .notebook-event { grid-template-columns: 52px 12px minmax(0,1fr); gap: 4px; padding: 16px 0; }
  .notebook-time { font-size: 11px; }
  .notebook-time small { max-width: 40px; white-space: normal; font-size: 8px; }
  .notebook-dot { width: 7px; height: 7px; margin-left: 2px; }
  .notebook-entry, .file-row { margin-left: 0; padding-left: 5px; }
  .notebook-entry-head span { display: none; }
  .entry-actions { gap: 0; opacity: 1; }
  .entry-actions > button { display: none; }
  .entry-actions-menu { display: block; }
  .file-row { grid-template-columns: 34px minmax(0,1fr); }
  .file-icon { width: 34px; height: 34px; }
  .file-open { grid-column: 2; justify-self: start; padding: 0; }
  .notebook-empty { margin-left: 68px; }
  .notebook-composer { width: calc(100% - 20px); margin-bottom: 8px; }
  .composer textarea { min-height: 44px; max-height: 150px; padding: 10px 13px 7px; resize: none; transition: min-height .15s ease; }
  .composer:focus-within textarea { min-height: 92px; }
  .composer-tools { align-items: flex-end; }
  .insert-tools { flex-wrap: wrap; }
  .insert-tools button { padding: 0 4px; font-size: 10px; }
  .occurrence-button span { max-width: 74px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .composer-send { padding: 0 10px; white-space: nowrap; }
  .rail-section { padding: 18px; }
  .document-layout { grid-template-columns: 1fr; }
  .document-toc { position: static; display: flex; overflow-x: auto; border-bottom: 1px solid var(--line); }
  .document-toc a { flex: 0 0 auto; border-left: 0; border-bottom: 2px solid transparent; }
  .document-toc a.is-active { border-bottom-color: var(--forest-800); }
  .document-body { padding: 8px 20px 28px; border-left: 0; }
  .document-header { min-height: 0; align-items: start; padding: 22px 20px; }
  .document-header h1 { font-size: 20px; }
  .document-project-action { min-height: 34px; padding: 0 9px; font-size: 11px; }
  .dialog-backdrop { align-items: end; padding: 0; }
  .dialog, .dialog.is-wide { width: 100%; max-height: 90vh; border-radius: 12px 12px 0 0; }
  .dialog-header, .dialog-body, .dialog-actions { padding-left: 18px; padding-right: 18px; }
  .dialog-actions > button { flex: 1; }
  .lab2-guide { grid-template-columns: 1fr; min-height: 0; margin-left: -18px; margin-right: -18px; }
  .lab2-guide-tabs { display: flex; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 10px 12px; scrollbar-width: thin; }
  .lab2-guide-tab { width: auto; min-width: max-content; min-height: 38px; padding: 0 10px; }
  .lab2-guide-panel { padding: 20px 18px 24px; }
  .lab2-guide-item { padding: 11px; }
  .lab2-guide-progress { display: none; }
  .lab2-guide-actions { width: auto; flex: 1; }
  .lab2-guide-actions > button { flex: 1; }
  .outcome-options { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .outcome-options label > span { min-height: 50px; padding: 7px 5px; }
  .completion-facts { justify-content: space-between; }
  .completion-facts span { padding: 0 9px; font-size: 11px; }
  .project-draft-fields > label { grid-template-columns: 1fr; gap: 5px; }
  .project-draft-fields > label > span { padding-top: 0; }
  .project-draft > header { align-items: start; flex-direction: column; justify-content: center; gap: 3px; padding-top: 8px; padding-bottom: 8px; }
  .project-overview-head { gap: 16px; }
  .project-overview-head h1 { font-size: 30px; }
  .project-overview-head .primary-button { padding: 0 11px; white-space: nowrap; }
  .project-state-grid { grid-template-columns: 1fr; }
  .project-state-grid > div + div { border-left: 0; border-top: 1px solid var(--line); }
  .project-quick-start > div span { display: none; }
  .quick-capture { margin-top: 10vh; }
  .quick-capture h1 { font-size: 31px; }
  .quick-composer > div span { display: none; }
  .experiment-overview-head, .comparison-head { align-items: stretch; flex-direction: column; }
  .experiment-overview-head .primary-button, .comparison-head .primary-button { align-self: start; }
  .run-row { grid-template-columns: minmax(0,1fr) auto; }
  .run-row .ui-icon { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
