/* A private research notebook inside the existing KlorPlay product surface. */
/* Saved research: a directory and a readable page, independent of the editor. */
.research-notebook {
  display: grid;
  grid-template-columns: minmax(210px, 245px) minmax(0, 1fr);
  min-width: 0;
  min-height: 65vh;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  overflow: clip;
}
.research-notebook [hidden] { display: none; }
.rn-sidebar { min-width: 0; padding: 22px 14px; border-right: 1px solid var(--line); background: var(--bg); }
.rn-sidebar > [data-notebook-directory] { position: sticky; top: 16px; max-height: calc(100vh - 150px); overflow-y: auto; }
.rn-directory-title, .rn-section-title { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.rn-directory-title h2 { font-size: 15px; margin: 0; }
.rn-directory-title > span { color: var(--muted); font-size: 13px; }
.rn-directory-toggle { display: none; }
.rn-new { width: 100%; margin: 16px 0; background: transparent; justify-content: flex-start; }
.rn-tree, .rn-tree ul { padding: 0; margin: 0; list-style: none; }
.rn-tree > li + li { margin-top: 8px; }
.rn-tree ul { border-left: 1px solid var(--line); margin: 5px 0 12px 17px; padding-left: 10px; }
.rn-tree button, .rn-library {
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  width: 100%;
  padding: 10px;
  min-height: 44px;
  border: 1px solid transparent;
  background: transparent;
  text-align: left;
  line-height: 1.65;
  overflow-wrap: anywhere;
}
.rn-tree button > span:last-child { min-width: 0; }
.rn-tree button[aria-current='page'] { background: var(--raised); color: var(--accent); border-color: var(--line); }
.rn-tree ul button { font-size: 13px; }
.rn-tree small { margin-left: auto; color: var(--muted); }
.rn-library { margin-top: 25px; color: var(--muted); border-top: 1px solid var(--line); border-radius: 0; }
.rn-main { min-width: 0; }
.rn-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 25px 30px 18px; }
.rn-header > div { min-width: 0; }
.rn-header h1 { font-size: clamp(20px, 1.7vw, 25px); line-height: 1.55; margin: 4px 0 0; overflow-wrap: anywhere; }
.rn-header > button { flex: none; }
.rn-breadcrumb { margin: 0; font-size: 13px; color: var(--muted); }
.rn-tabs { display: flex; flex-wrap: wrap; gap: 3px; padding: 0 25px; border-bottom: 1px solid var(--line); }
.rn-tabs:empty { border: 0; }
.rn-tabs button { min-height: 46px; border: 0; border-radius: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted); }
.rn-tabs button[aria-current='page'] { border-bottom-color: var(--accent); color: var(--text); }
.rn-notice { margin: 0; color: var(--warning); padding: 0 30px; overflow-wrap: anywhere; }
.rn-notice:not(:empty) { padding-block: 12px; border-bottom: 1px solid var(--line); }
.rn-reading { padding: 28px 30px 40px; max-width: 80ch; margin-inline: 0; overflow-wrap: anywhere; }
.rn-reading h2 { font-size: 17px; margin: 0; }
.rn-state { display: inline-block; font-size: 12px; line-height: 1.6; color: var(--muted); border: 1px solid var(--line); border-radius: 5px; padding: 3px 7px; }
.rn-question { margin: 16px 0 26px; font-size: 19px; line-height: 1.85; }
.rn-source-entry { display: flex; align-items: center; justify-content: space-between; gap: 20px; border-block: 1px solid var(--line); padding: 18px 0; }
.rn-source-entry strong { font-size: 15px; }
.rn-source-entry p { margin: 5px 0 0; font-size: 13px; color: var(--muted); }
.rn-source-entry a { flex: none; }
.rn-prose-fields, .research-method-prose { display: block; margin: 0; padding: 0; max-width: 80ch; }
.rn-prose-fields > div, .research-method-prose > div { display: block; padding: 23px 0; border-bottom: 1px solid var(--line); min-width: 0; }
.rn-prose-fields dt, .research-method-prose dt { font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 9px; }
.rn-prose-fields dd, .research-method-prose dd { margin: 0; font-size: 15px; line-height: 1.95; white-space: pre-wrap; overflow-wrap: anywhere; }
.rn-evidence { margin-top: 18px; font-size: 14px; }
.rn-evidence summary, .rn-document-list summary { min-height: 40px; padding-block: 9px; cursor: pointer; color: var(--muted); }
.rn-evidence code, .rn-document-list code { overflow-wrap: anywhere; white-space: pre-wrap; font-size: 12px; }
.rn-lead, .rn-native-note { color: var(--muted); line-height: 1.8; }
.rn-document-list { list-style: none; padding: 0; margin: 24px 0; }
.rn-document-list > li { padding: 22px 0; border-block: 1px solid var(--line); }
.rn-document-list p { font-size: 14px; line-height: 1.8; }
.rn-document-heading { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.rn-document-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.rn-native-note { border-left: 2px solid var(--line); padding-left: 15px; font-size: 13px; }
.rn-empty { padding-block: 15px; color: var(--muted); line-height: 1.85; }
.rn-welcome { padding: 75px 30px; max-width: 60ch; margin: auto; }
.rn-welcome > span { font-size: 35px; color: var(--accent); }
.rn-welcome h2 { font-size: 22px; margin: 20px 0 14px; }
.rn-welcome p { line-height: 1.9; }
.rn-editor, [data-notebook-search] { padding: 25px 30px; min-width: 0; }
.rn-editor-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 14px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.rn-editor-tools p { color: var(--muted); font-size: 13px; flex: 1; margin: 0; }
.rn-editor label { display: grid; gap: 7px; margin: 18px 0; font-size: 14px; }
.rn-editor :is(input, textarea, select) { width: 100%; }
.rn-editor textarea { min-height: 110px; line-height: 1.8; resize: vertical; }
.rn-editor :is([data-method-card-editor], [data-comparison-items-editor], [data-relations-editor]) { padding-top: 24px; margin-top: 24px; border-top: 1px solid var(--line); }
.rn-editor [data-collection-action='save'] { margin-block: 24px 8px; }
.rn-editor [data-collection-comparison] { margin-top: 25px; }
.rn-access-note { color: var(--muted); font-size: 13px; margin-top: 20px; max-width: 90ch; }
.rn-access-note summary { cursor: pointer; padding-block: 10px; min-height: 44px; }
.rn-access-note p { line-height: 1.8; }
@media (max-width: 900px) {
  .research-notebook { grid-template-columns: minmax(0, 1fr); }
  .rn-sidebar { border-right: 0; border-bottom: 1px solid var(--line); padding: 16px; }
  .rn-sidebar > [data-notebook-directory] { position: static; max-height: none; overflow: visible; }
  .rn-directory-toggle { display: inline-flex; margin-left: auto; min-height: 44px; padding: 6px 12px; background: transparent; }
  .rn-tree { max-height: 260px; overflow-y: auto; }
  .rn-library { margin-top: 12px; }
  .rn-new { margin-block: 10px; }
  .rn-header { padding: 22px 18px 15px; flex-wrap: wrap; }
  .rn-tabs { padding-inline: 12px; }
  .rn-reading, .rn-editor, [data-notebook-search] { padding: 22px 18px; }
  .rn-source-entry { align-items: flex-start; flex-direction: column; gap: 12px; }
  .rn-notice { padding-inline: 18px; }
  .rn-question { font-size: 17px; }
}

.rw-workbench {
  width: 100%;
  max-width: 1280px;
  margin-inline: auto;
  display: grid;
  gap: 22px;
  color: var(--text);
}
.rw-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}
.rw-header h1 {
  max-width: 28em;
  font-size: calc(25px * var(--ps-font-scale, 1));
  line-height: 1.4;
  letter-spacing: 0;
}
.rw-header p {
  margin-top: 8px;
  max-width: 65ch;
  color: var(--muted);
}
.rw-header-actions,
.rw-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.rw-header-actions {
  flex: none;
}
.rw-status-note {
  padding: 12px 16px;
  border-left: 3px solid var(--accent);
  background: var(--panel);
  font-size: var(--ps-font-support);
  color: var(--muted);
}
.rw-status-note strong {
  color: var(--text);
  font-weight: 600;
}
.rw-status-note p + p {
  margin-top: 4px;
}
.rw-cycle {
  display: flex;
  gap: 0;
  align-items: stretch;
  padding: 0;
  margin: 0;
  list-style: none;
  overflow-x: auto;
}
.rw-cycle li {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: max-content;
}
.rw-cycle li + li::before {
  content: '\2192';
  margin-inline: 8px;
  color: var(--muted);
}
.rw-cycle button {
  min-height: 42px;
  width: 100%;
  justify-content: flex-start;
  gap: 8px;
  padding: 7px 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  white-space: nowrap;
}
.rw-cycle button:hover {
  background: var(--raised);
  color: var(--text);
}
.rw-step-number {
  font-size: var(--ps-font-label);
  color: var(--accent);
}
.rw-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
}
.rw-tabs button {
  flex: none;
  min-height: 44px;
  padding: 9px 13px;
  border: 0;
  border-radius: 4px 4px 0 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: var(--muted);
}
.rw-tabs button[aria-selected='true'] {
  color: var(--text);
  border-bottom-color: var(--accent);
}
.rw-tabs button:hover {
  color: var(--text);
  background: var(--panel);
}
.rw-tab-count {
  color: var(--muted);
  font-size: var(--ps-font-label);
}
.rw-panel {
  min-width: 0;
  display: grid;
  gap: 18px;
}
.rw-sheet {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--shape-radius-content, 8px);
  background: var(--panel);
  padding: 20px;
}
.rw-section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}
.rw-section-heading h2 {
  font-size: calc(18px * var(--ps-font-scale, 1));
}
.rw-section-heading p,
.rw-description {
  margin-top: 5px;
  color: var(--muted);
  font-size: var(--ps-font-support);
  max-width: 70ch;
}
.rw-section-heading > button {
  flex: none;
}
.rw-empty {
  padding: 24px 0 12px;
  max-width: 65ch;
}
.rw-empty p {
  color: var(--muted);
  margin-top: 7px;
}
.rw-empty .rw-actions {
  margin-top: 15px;
}
.rw-columns {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
}
.rw-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.rw-item {
  min-width: 0;
  padding-block: 18px;
}
.rw-item:first-child {
  padding-top: 0;
}
.rw-item:last-child {
  padding-bottom: 0;
}
.rw-item + .rw-item {
  border-top: 1px solid var(--line);
}
.rw-item-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}
.rw-item-heading h3 {
  font-size: var(--ps-font-body);
  font-weight: 650;
  overflow-wrap: anywhere;
}
.rw-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  align-items: center;
  margin-top: 7px;
  color: var(--muted);
  font-size: var(--ps-font-label);
}
.rw-label {
  display: inline-block;
  padding: 2px 7px;
  border: 1px solid var(--line);
  border-radius: var(--shape-radius-row, 4px);
  color: var(--text);
  background: var(--raised);
  font-size: var(--ps-font-label);
  white-space: nowrap;
}
.rw-label-plain {
  background: transparent;
  color: var(--muted);
}
.rw-text {
  margin-top: 12px;
  max-width: 76ch;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.75;
}
.rw-link {
  overflow-wrap: anywhere;
}
.rw-subsection {
  margin-top: 16px;
}
.rw-subsection > h3 {
  margin-bottom: 7px;
}
.rw-reference-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 0;
  margin: 12px 0 0;
  list-style: none;
}
.rw-reference-list a {
  font-size: var(--ps-font-support);
}
.rw-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 20px;
  margin-block: 14px 0;
  font-size: var(--ps-font-support);
}
.rw-facts > div {
  min-width: 0;
}
.rw-facts dt {
  color: var(--muted);
  font-size: var(--ps-font-label);
}
.rw-facts dd {
  margin: 3px 0 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.rw-details {
  font-size: var(--ps-font-support);
  color: var(--muted);
}
.rw-details > summary {
  cursor: pointer;
  color: var(--text);
  padding: 5px 0;
}
.rw-details > div {
  padding-top: 9px;
}
.rw-details p + p,
.rw-details li + li {
  margin-top: 8px;
}
.rw-matrix-scroll {
  max-width: 100%;
  overflow-x: auto;
  margin-top: 15px;
}
.rw-matrix {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
  font-size: var(--ps-font-support);
}
.rw-matrix th,
.rw-matrix td {
  padding: 12px;
  vertical-align: top;
  text-align: left;
  border: 1px solid var(--line);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.rw-matrix th {
  color: var(--muted);
  background: var(--raised);
  font-weight: 500;
}
.rw-matrix td:first-child {
  width: 24%;
}
.rw-timeline {
  padding-left: 18px;
  margin-top: 18px;
  border-left: 2px solid var(--line);
}
.rw-timeline .rw-item {
  position: relative;
}
.rw-timeline .rw-item::before {
  position: absolute;
  content: '';
  top: 24px;
  left: -24px;
  height: 10px;
  width: 10px;
  background: var(--panel);
  border: 2px solid var(--accent);
  border-radius: 50%;
}
.rw-timeline .rw-item:first-child::before {
  top: 6px;
}
.rw-assessment-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 30px;
}
.rw-assessment-row {
  padding: 17px 0;
  border-top: 1px solid var(--line);
  min-width: 0;
}
.rw-assessment-row .rw-item-heading {
  align-items: center;
}
.rw-score {
  font-size: calc(20px * var(--ps-font-scale, 1));
  color: var(--accent);
  white-space: nowrap;
}
.rw-score small {
  font-size: var(--ps-font-label);
}
.rw-score-pending {
  font-size: var(--ps-font-support);
  color: var(--muted);
}
.rw-assessment-row p {
  margin-top: 8px;
  max-width: 55ch;
  font-size: var(--ps-font-support);
  color: var(--muted);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.rw-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 15px;
}
.rw-form label {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: var(--text);
  font-size: var(--ps-font-support);
}
.rw-form input,
.rw-form textarea,
.rw-form select {
  width: 100%;
  min-width: 0;
}
.rw-form textarea {
  min-height: 112px;
  resize: vertical;
  line-height: 1.65;
}
.rw-form .rw-wide {
  grid-column: 1 / -1;
}
.rw-field-hint {
  margin-top: 3px;
  color: var(--muted);
  font-size: var(--ps-font-label);
}
.rw-checks {
  border: 1px solid var(--line);
  border-radius: var(--shape-radius-field, 7px);
  padding: 10px 12px;
  margin: 0;
  max-height: 190px;
  overflow-y: auto;
}
.rw-checks legend {
  padding-inline: 4px;
  color: var(--muted);
  font-size: var(--ps-font-support);
}
.rw-checks label {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  margin-top: 7px;
  font-size: var(--ps-font-support);
}
.rw-checks input[type='checkbox'] {
  width: 18px;
  min-height: 18px;
  flex: none;
}
.rw-form-actions {
  padding-top: 5px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}
.rw-link:focus-visible,
.rw-details summary:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}
@media (max-width: 1000px) {
  .rw-columns {
    grid-template-columns: minmax(0, 1fr);
  }
  .rw-cycle li {
    flex: none;
  }
  .rw-header {
    flex-direction: column;
    gap: 13px;
  }
}
@media (max-width: 640px) {
  .rw-workbench {
    gap: 17px;
  }
  .rw-header h1 {
    font-size: calc(21px * var(--ps-font-scale, 1));
  }
  .rw-sheet {
    padding: 15px;
  }
  .rw-tabs {
    gap: 0;
  }
  .rw-tabs button {
    padding-inline: 11px;
  }
  .rw-section-heading {
    flex-direction: column;
    gap: 11px;
  }
  .rw-assessment-grid,
  .rw-facts,
  .rw-form {
    grid-template-columns: minmax(0, 1fr);
  }
  .rw-item-heading {
    flex-wrap: wrap;
  }
  .rw-form .rw-wide {
    grid-column: 1;
  }
}
