.notebook-page {
  overflow: hidden;
  background: var(--surface-low);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.notebook-masthead {
  height: 64px;
  display: grid;
  grid-template-columns: 260px 1fr auto;
  align-items: center;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.notebook-product {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
}

.notebook-product:hover { color: var(--text); }
.notebook-product > span:last-child { display: grid; line-height: 1.15; }
.notebook-product strong { font-size: 15px; }
.notebook-product small { margin-top: 4px; color: var(--muted); font-size: 11px; }

.notebook-masthead nav {
  display: flex;
  justify-content: center;
  gap: 22px;
}

.notebook-masthead nav a {
  padding: 21px 1px 18px;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.notebook-masthead nav a[aria-current="page"] {
  border-bottom-color: var(--green-dark);
  color: var(--text);
}

.notebook-worker-state {
  color: var(--muted);
  font: 600 10px/1.2 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.notebook-layout {
  display: grid;
  grid-template-columns: 260px minmax(480px, 1fr) 330px;
  height: calc(100vh - var(--suite-bar-h) - 64px);
  min-height: 0;
}

.notebook-list-pane,
.notebook-source-pane,
.notebook-chat-pane {
  min-width: 0;
  min-height: 0;
  background: var(--surface);
}

.notebook-list-pane,
.notebook-source-pane {
  padding: 20px;
  overflow-y: auto;
}

.notebook-list-pane { border-right: 1px solid var(--line); }
.notebook-source-pane { border-left: 1px solid var(--line); }

.notebook-pane-head,
.notebook-chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.notebook-pane-head h1,
.notebook-pane-head h2,
.notebook-chat-head h2,
.notebook-welcome h2 {
  margin: 2px 0 0;
  font-size: 18px;
  line-height: 1.25;
}

.notebook-kicker {
  margin: 0;
  color: var(--green-dark);
  font: 800 10px/1.2 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: .07em;
  text-transform: uppercase;
}

.notebook-primary {
  border-color: var(--green-dark);
  background: var(--green-dark);
  color: var(--on-primary);
  font-weight: 700;
}

.notebook-primary:hover { background: var(--primary-hover); }

.notebook-search { display: block; margin: 17px 0 12px; }
.notebook-search input,
.notebook-dialog input,
.notebook-composer textarea,
.notebook-composer select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
}

.notebook-search input,
.notebook-dialog input { min-height: 38px; padding: 8px 10px; }

.notebook-search input:focus,
.notebook-dialog input:focus,
.notebook-composer textarea:focus,
.notebook-composer select:focus {
  outline: 2px solid oklch(0.65 0.15 158 / .23);
  border-color: var(--green-dark);
}

.notebook-list { display: grid; gap: 3px; }

.notebook-list-item {
  width: 100%;
  min-height: 62px;
  padding: 10px 11px;
  display: grid;
  gap: 4px;
  border: 1px solid transparent;
  background: transparent;
  text-align: left;
}

.notebook-list-item:hover { background: var(--surface-low); }
.notebook-list-item.active {
  border-color: var(--line);
  background: var(--primary-softer);
}
.notebook-list-item strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notebook-list-item span { color: var(--muted); font-size: 11px; }

.notebook-empty {
  padding: 22px 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.notebook-chat-pane {
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  background: var(--bg);
}

.notebook-chat-head {
  min-height: 75px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.notebook-head-actions { display: flex; gap: 7px; }
.notebook-head-actions button { min-height: 32px; font-size: 12px; }

.notebook-welcome {
  align-self: center;
  justify-self: center;
  width: min(520px, calc(100% - 48px));
  padding: 30px;
  border: 1px solid var(--line);
  background: var(--surface);
}
.notebook-welcome h2 { margin: 9px 0; font-family: ui-serif, Georgia, serif; font-size: 26px; }
.notebook-welcome p:last-child { margin: 0; color: var(--muted); line-height: 1.65; }

.message-feed {
  overflow-y: auto;
  padding: 28px max(28px, calc((100% - 760px) / 2));
}

.research-message { margin: 0 0 24px; }
.research-message.user { display: flex; justify-content: flex-end; }
.research-message.user .message-content {
  max-width: 72%;
  padding: 10px 13px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.research-message.assistant .message-label {
  margin-bottom: 8px;
  color: var(--green-dark);
  font: 800 10px/1.2 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.research-message.assistant .message-content {
  font-family: ui-serif, Georgia, serif;
  font-size: 16px;
  line-height: 1.7;
}

.message-content p { margin: 0 0 12px; }
.message-content p:last-child { margin-bottom: 0; }
.message-citation {
  min-height: 23px;
  margin: 0 2px;
  padding: 1px 6px;
  border-color: oklch(0.69 0.09 158);
  background: var(--primary-softer);
  color: var(--green-dark);
  font: 800 10px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  vertical-align: .1em;
}

.message-meta {
  display: flex;
  gap: 10px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 11px;
}
.message-meta button { min-height: 27px; padding: 2px 8px; font-size: 11px; }
.research-message.superseded { opacity: .55; }

.turn-status {
  margin: 0 max(28px, calc((100% - 760px) / 2)) 12px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
}
.turn-status[hidden] { display: none; }
.turn-status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green-dark); }
.turn-status button { min-height: 28px; margin-left: auto; }

.notebook-composer {
  padding: 14px max(28px, calc((100% - 760px) / 2)) 20px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}
.notebook-composer > label { display: block; margin-bottom: 7px; font-size: 11px; font-weight: 800; }
.notebook-composer textarea { display: block; min-height: 78px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.composer-controls { margin-top: 8px; display: flex; align-items: center; gap: 10px; }
.composer-mode { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 11px; }
.composer-mode select { width: auto; min-height: 32px; padding: 4px 25px 4px 8px; }
#composer-hint { flex: 1; color: var(--muted); font-size: 11px; }

.scope-summary {
  margin: 15px 0;
  padding: 11px;
  border-left: 3px solid var(--green-dark);
  background: var(--primary-softer);
  color: var(--muted);
  font-size: 12px;
}
.source-list { display: grid; gap: 6px; }
.source-row { padding: 9px 10px; border: 1px solid var(--line); }
.source-row strong { display: block; font-size: 12px; }
.source-row span { color: var(--muted); font-size: 10px; text-transform: uppercase; }

.evidence-inspector { margin-top: 25px; padding-top: 20px; border-top: 1px solid var(--line); }
.evidence-inspector h3 { margin: 7px 0 3px; font-size: 15px; }
.evidence-meta { margin: 0 0 12px; color: var(--muted); font-size: 11px; }
.evidence-inspector blockquote {
  margin: 0;
  padding: 13px 0 13px 15px;
  border-left: 3px solid var(--green-dark);
  font-family: ui-serif, Georgia, serif;
  font-size: 14px;
  line-height: 1.6;
}
.evidence-inspector details { margin-top: 12px; color: var(--muted); font-size: 11px; }
.evidence-inspector details p { white-space: pre-wrap; color: var(--text); line-height: 1.55; }
.evidence-actions { display: grid; gap: 5px; margin-top: 14px; font-size: 12px; font-weight: 700; }
.evidence-provenance { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; margin-top: 16px; font-size: 10px; }
.evidence-provenance dt { color: var(--muted); }
.evidence-provenance dd { margin: 0; overflow-wrap: anywhere; }

.notebook-dialog {
  width: min(590px, calc(100% - 32px));
  max-height: calc(100vh - 48px);
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
}
.notebook-dialog::backdrop { background: oklch(0.12 0.025 255 / .55); }
.notebook-dialog form { padding: 23px; }
.notebook-dialog header,
.notebook-dialog footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.notebook-dialog h2 { margin: 3px 0 0; font-size: 20px; }
.notebook-dialog form > label { display: grid; gap: 7px; margin-top: 22px; font-size: 12px; font-weight: 700; }
.notebook-dialog fieldset { margin: 18px 0 0; padding: 0; border: 0; }
.notebook-dialog legend { margin-bottom: 8px; font-size: 12px; font-weight: 700; }
.scope-choice { display: flex; gap: 8px; margin: 8px 0; color: var(--muted); }
.scope-choice input { width: auto; min-height: auto; }
.show-picker { max-height: 230px; margin-top: 12px; overflow-y: auto; border: 1px solid var(--line); }
.show-picker label { display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-bottom: 1px solid var(--line); font-size: 12px; }
.show-picker label:last-child { border-bottom: 0; }
.show-picker input { width: auto; min-height: auto; }
.dialog-error { color: var(--danger); font-size: 12px; }
.notebook-dialog footer { margin-top: 22px; justify-content: flex-end; }

@media (max-width: 1100px) {
  .notebook-layout { grid-template-columns: 220px minmax(430px, 1fr) 280px; }
  .notebook-masthead { grid-template-columns: 220px 1fr auto; }
}

@media (max-width: 860px) {
  .notebook-page { overflow: auto; }
  .notebook-masthead { grid-template-columns: 1fr auto; padding: 0 15px; }
  .notebook-masthead nav { display: none; }
  .notebook-layout { display: block; height: auto; }
  .notebook-list-pane,
  .notebook-source-pane { border: 0; border-bottom: 1px solid var(--line); }
  .notebook-list-pane { max-height: 290px; }
  .notebook-source-pane { min-height: 260px; }
  .notebook-chat-pane { min-height: 70vh; }
  .message-feed { min-height: 320px; }
}

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