/* Research screen (#/research, #/research/:id). Tokens only; no italics. */
.rs { max-width: 1120px; }
.rs-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px 24px; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.rs-head h1 { margin: 0 0 8px; font-size: clamp(22px, 2.6vw, 28px); }

/* Always-on control */
.rs-mode { border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 16px; }
.rs-mode-row { display: flex; align-items: center; gap: 12px 16px; flex-wrap: wrap; }
.rs-mode-title { font-weight: 500; }
.rs-mode-help { margin: 8px 0 12px; max-width: 70ch; }
.rs-today { margin-left: auto; font-size: 13px; color: var(--ink-60); }
.rs-mode-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px 20px; align-items: start; margin-bottom: 8px; }
.rs-field select, .rs-field input { height: 44px; }
.rs-field { display: flex; flex-direction: column; gap: 6px; margin: 0; }
.rs-field > span, .rs-field-label { font-size: 13px; color: var(--muted); }
.rs-cap { max-width: 120px; }
.rs-warning { border-left: 3px solid var(--warn); background: var(--warn-soft); color: var(--ink); padding: 10px 12px; font-size: 14px; margin: 8px 0 0; max-width: 78ch; }

.rs-switch { border: 0; background: transparent; padding: 4px 0; gap: 10px; }
.rs-switch:hover { border: 0; }
.rs-switch-track { width: 38px; height: 22px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); position: relative; flex: none; transition: background var(--duration) var(--ease); }
.rs-switch-knob { position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--ink-40); transition: transform var(--duration) var(--ease), background var(--duration) var(--ease); }
.rs-switch[aria-checked="true"] .rs-switch-track { background: var(--accent); border-color: var(--accent); }
.rs-switch[aria-checked="true"] .rs-switch-knob { transform: translateX(16px); background: var(--accent-ink); }
.rs-switch-label { font-weight: 500; text-align: left; }
.rs-switch-state { font-size: 12px; color: var(--muted); }

/* Admin bar */
.rs-admin { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.rs-admin:empty { display: none; }
.rs-admin .small { max-width: 80ch; }

/* Tabs */
.rs-tabs { display: flex; gap: 2px; overflow-x: auto; max-width: 100%; }
.rs-tab { border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: transparent; padding: 10px 14px; color: var(--ink-60); }
.rs-tab:hover { border-color: transparent; border-bottom-color: var(--line); color: var(--ink); }
.rs-tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.rs-count { font-size: 12px; color: var(--muted); }
.rs-subtabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 12px 0 16px; }
.rs-subtab { padding: 6px 12px; font-size: 13px; border-radius: 999px; }
.rs-subtab[aria-selected="true"] { background: var(--accent-soft); border-color: var(--accent-line); }

/* Library: search and bands on one row, section list, slim rows */
.rs-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 14px; }
.rs-search { flex: 1 1 240px; width: auto; padding: 7px 12px; font-size: 14px; background: var(--card); }
.rs-bands { display: flex; flex-wrap: wrap; gap: 6px; }
.rs-band { padding: 6px 12px; font-size: 13px; border-radius: 999px; box-shadow: none; }
.rs-band[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
/* The phone's section jumps */
.rs-nav { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 14px; }
.rs-nav-item { gap: 6px; padding: 5px 10px; border: 1px solid var(--line); border-radius: 999px; background: none; font-weight: 400; font-size: 13px; box-shadow: none; }
.rs-nav-item:hover { transform: none; box-shadow: none; }
.rs-nav-n, .rs-sec-n { color: var(--muted); font-size: 12.5px; font-weight: 400; letter-spacing: 0; }
.rs-sec { margin-bottom: 22px; scroll-margin-top: 72px; }
.rs-sec-head { display: flex; justify-content: space-between; align-items: baseline; font: 600 14px/1.3 var(--sans); letter-spacing: 0.05em; text-transform: uppercase; margin: 0 0 8px; }
.rs-list { background: var(--card); border: 1px solid color-mix(in srgb, var(--line) 70%, transparent); border-radius: var(--radius-lg); box-shadow: var(--shadow); overflow: hidden; }
.rs-row { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 8px 14px; text-decoration: none; border-top: 1px solid var(--line); }
.rs-row:first-child { border-top: 0; }
.rs-row:hover { background: var(--orange-soft); }
.rs-row-title { min-width: 0; }
.rs-row-meta { flex: none; }
.rs-film { width: 100%; border-collapse: collapse; font-size: 14px; }
.rs-film th, .rs-film td { padding: 7px 14px; text-align: left; font-weight: 400; border-top: 1px solid var(--line); }
.rs-film thead th { border-top: 0; color: var(--muted); font-size: 13px; }
.rs-film + .rs-row { border-top: 1px solid var(--line); }
.rs-src-count { margin: -6px 0 8px; }
.rs-srcrow { padding: 9px 14px; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.rs-srcrow:first-child { border-top: 0; }
@media (max-width: 720px) {
  .rs-row { flex-direction: column; gap: 2px; }
}

/* The side bar: in the same place on every research page, its sections opening in place. Same column and scroll as Archive's filters. */
.rs-shell.has-bar { display: grid; grid-template-columns: 248px minmax(0, 1fr); gap: 40px; align-items: start; }
.rs-panel { min-width: 0; }
.rs-panel.is-note { min-height: calc(100vh - 88px); }
.rs-bar { position: sticky; top: 72px; max-height: calc(100vh - 88px); overflow: auto; margin-left: -2px; padding: 0 8px 6px 2px; scrollbar-width: thin; }
.rs-tree-sec { border-top: 1px solid var(--line); }
.rs-tree-sec:first-child { border-top: 0; }
.rs-tree-head { width: 100%; justify-content: flex-start; gap: 8px; padding: 9px 0; border: 0; border-radius: 0; background: none; box-shadow: none; text-align: left; font: 600 14px/1.3 var(--sans); letter-spacing: 0.05em; text-transform: uppercase; color: var(--ink); }
.rs-tree-head:hover { color: var(--accent); transform: none; box-shadow: none; }
.rs-tree-head .rs-nav-n { margin-left: auto; }
.rs-tree-x { width: 12px; text-align: center; font-weight: 400; font-size: 13px; color: var(--ink-40); }
/* The open section is the navy card, with white words; light orange marks hover and the open note. */
.rs-tree-items { display: grid; gap: 2px; margin-bottom: 10px; padding: 8px; background: var(--encre-bleue); color: var(--white); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.rs-tree-item { display: block; padding: 5px 8px; border-radius: var(--radius); font-size: 13.5px; line-height: 1.3; text-decoration: none; }
.rs-tree-item:hover, .rs-tree-cell:hover { background: var(--orange-soft); color: var(--accent); }
.rs-tree-item[aria-current] { background: var(--orange-soft); color: var(--accent); box-shadow: inset 3px 0 0 var(--orange); padding-left: 10px; font-weight: 500; }
.rs-tree-film { width: 100%; border-collapse: collapse; font-size: 13px; line-height: 1.3; margin: 2px 0 4px; }
.rs-tree-film th { font-weight: 400; text-align: left; padding: 4px 4px 4px 8px; }
.rs-tree-film thead th { font-size: 12.5px; opacity: 0.7; }
.rs-tree-film thead th:not(:first-child) { padding-inline: 0; text-align: center; }
.rs-tree-film td { width: 50px; padding: 1px; text-align: center; }
.rs-tree-cell { display: block; padding: 3px 0; border-radius: var(--radius); font-size: 12.5px; text-decoration: none; color: color-mix(in srgb, var(--white) 80%, transparent); }
.rs-tree-cell[aria-current] { background: var(--orange-soft); box-shadow: inset 0 0 0 1px var(--orange-line); color: var(--accent); font-weight: 500; }

/* The open note's parts, nested under it. */
.rs-tree-parts { display: grid; gap: 1px; margin: 2px 0 6px 10px; padding-left: 8px; border-left: 1px solid color-mix(in srgb, var(--white) 30%, transparent); }
.rs-tree-part { justify-content: flex-start; padding: 3px 6px; border: 0; border-radius: var(--radius); background: none; box-shadow: none; text-align: left; font-weight: 400; font-size: 12.5px; line-height: 1.3; color: color-mix(in srgb, var(--white) 80%, transparent); }
.rs-tree-part:hover { background: var(--orange-soft); color: var(--accent); transform: none; box-shadow: none; }
.rs-tree-part.is-here { color: var(--white); font-weight: 500; }
.rs-tree-part.is-here:not(:hover) { box-shadow: inset 2px 0 0 var(--orange); }

/* The phone: a strip on a note, and the same list in the More sheet */
.rs-strip { position: sticky; top: 0; z-index: 15; display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: -20px -16px 18px; padding: 8px 16px; background: var(--paper); border-bottom: 1px solid var(--line); font-size: 14px; }
.rs-strip-back { color: var(--muted); text-decoration: none; padding: 6px 0; }
.rs-strip-where { padding: 6px 0; border: 0; border-radius: 0; background: none; box-shadow: none; font-weight: 500; text-align: right; }
.rs-strip-where::after { content: ' ▾'; font-size: 12px; color: var(--muted); white-space: pre; }
.rs-sheet { padding-inline: 16px; }
.nav-sheet .rs-tree-items { margin-bottom: 10px; }
.nav-sheet .rs-tree-head { display: flex; padding: 11px 0; font: 600 14px/1.3 var(--sans); }
.nav-sheet .rs-tree-item { padding: 9px 8px; font-size: 15px; }
.nav-sheet .rs-tree-part { padding: 7px 8px; font-size: 14px; }
.nav-sheet .rs-tree-item[aria-current] { padding-left: 10px; font-weight: 500; }
.nav-sheet .rs-tree-cell { padding: 7px 0; font-size: 14px; }
.nav-sheet .rs-tree-cell[aria-current] { font-weight: 500; }
.nav-sheet .rs-tree-film { font-size: 14px; }

/* Requests */
.rs-req-list, .rs-drafts { display: flex; flex-direction: column; gap: 12px; }
.rs-req { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; background: var(--bg); }
.rs-req.rs-busy { border-color: var(--warn); }
.rs-req-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.rs-req-q { margin: 10px 0 6px; font-size: 16px; max-width: 75ch; }
.rs-req p { margin: 0 0 8px; max-width: 80ch; }
.rs-chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
.rs-recs { display: flex; gap: 6px 10px; flex-wrap: wrap; align-items: baseline; margin: 6px 0; }
.rs-rec { font-size: 13px; }
.rs-req-actions { margin-top: 12px; }
.rs-running { display: inline-flex; gap: 8px; align-items: center; color: var(--warn); }
.rs-error { color: var(--danger); background: var(--danger-soft); padding: 8px 10px; border-radius: var(--radius); }
.rs-history { margin-top: 10px; }
.rs-history summary { cursor: pointer; color: var(--muted); }
.rs-history ol { margin: 8px 0 0; padding-left: 18px; }
.rs-history li { margin-bottom: 4px; }
.rs-history strong { font-weight: 500; }

/* Drafts */
.rs-draft { border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); }
.rs-draft-head { width: 100%; justify-content: flex-start; border: 0; background: transparent; padding: 14px 16px; text-align: left; gap: 12px; flex-wrap: wrap; line-height: 1.35; }
.rs-draft-head:hover { background: var(--accent-soft); border: 0; }
.rs-draft-title { flex: 1; min-width: 200px; font-weight: 500; }
.rs-draft-body { padding: 4px 16px 18px; border-top: 1px solid var(--line); }
.rs-decide { margin: 20px 0 8px; padding-top: 16px; border-top: 1px solid var(--line); }
.rs-reread { margin-top: 12px; max-width: 72ch; }

/* Note reader */
.rs-reader { max-width: 760px; }
/* The note sits on a white card, like the library's lists. Its search stays in reach while reading. */
/* Each part sits on its own white card, so a long note reads in clear divisions. */
.rs-reader .rs-note { display: grid; gap: 14px; }
.rs-reader .rs-note > * { min-width: 0; margin: 0; }
.rs-reader .rs-head-card, .rs-reader .rs-section { padding: 22px 28px; background: var(--card); border: 1px solid color-mix(in srgb, var(--line) 70%, transparent); border-radius: var(--radius-lg); box-shadow: var(--shadow); scroll-margin-top: 124px; }
.rs-reader .rs-section > h2 { margin-top: 0; }
.rs-reader .rs-section > .rs-md > :last-child { margin-bottom: 0; }
.rs-reader .rs-head-card > :last-child { margin-bottom: 0; }
.rs-find { position: sticky; top: 56px; z-index: 5; display: flex; align-items: center; gap: 8px 10px; padding: 8px 0 10px; background: var(--paper); }
.rs-find .rs-search { flex: 1 1 200px; min-width: 0; }
.rs-find [hidden] { display: none; }
.rs-find-n { flex: none; font-variant-numeric: tabular-nums; }
.rs-mark { background: var(--orange-soft); color: inherit; box-shadow: inset 0 -2px 0 var(--orange-line); }
.rs-mark.is-here { background: var(--orange); color: var(--encre); }
.rs-back { display: inline-block; margin-bottom: 18px; color: var(--muted); }
.rs-note { font-size: 16px; line-height: 1.65; }
.rs-note-meta { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin-bottom: 12px; }
.rs-note-title { margin: 0 0 12px; max-width: 30ch; }
h2.rs-note-title { max-width: none; font-size: 19px; margin-top: 12px; }
.rs-question { color: var(--ink-60); max-width: 68ch; }
.rs-summary { font-size: 17px; max-width: 68ch; }
.rs-unverified { border: 1px solid var(--warn); background: var(--warn-soft); border-radius: var(--radius); padding: 12px 16px; margin: 0 0 20px; max-width: 68ch; }
.rs-unverified ul { margin: 6px 0 0; padding-left: 18px; font-size: 14px; }
.rs-section { margin-top: 28px; }
.rs-section > h2 { font-size: 19px; }
.rs-md { max-width: 68ch; }
.rs-md p, .rs-md ul, .rs-md ol, .rs-md blockquote { margin: 0 0 1em; }
.rs-md ul, .rs-md ol { padding-left: 20px; }
.rs-md li { margin-bottom: 4px; }
.rs-md blockquote { border-left: 2px solid var(--line); padding-left: 14px; color: var(--ink-60); }
.rs-md strong { font-weight: 600; }
.rs-md code { background: var(--surface-2); padding: 1px 4px; border-radius: var(--radius); }
.rs-table { overflow-x: auto; margin: 0 0 1em; max-width: 100%; border: 1px solid var(--line); border-radius: var(--radius); }
.rs-table table { border-collapse: collapse; font-size: 13px; line-height: 1.45; min-width: 100%; }
.rs-table th, .rs-table td { text-align: left; vertical-align: top; padding: 7px 10px; border-bottom: 1px solid var(--line); }
.rs-table th { font-weight: 500; background: var(--surface); }
.rs-table tr:last-child td { border-bottom: 0; }
.rs-cite { font-size: 11px; line-height: 1; padding: 2px 4px; margin: 0 1px; vertical-align: super; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink-60); gap: 0; }
.rs-cite:hover { border-color: var(--accent-line); color: var(--ink); }
.rs-sources { list-style: none; padding: 0; margin: 0; font-size: 14px; line-height: 1.5; max-width: 72ch; }
.rs-sources li { display: grid; grid-template-columns: 36px 1fr; gap: 8px; padding: 8px 6px; border-bottom: 1px solid var(--line); border-radius: var(--radius); transition: background var(--duration) var(--ease); }
.rs-sources li.rs-flash { background: var(--accent-soft); }
.rs-src-n { color: var(--muted); text-align: right; }
.rs-src-body { overflow-wrap: anywhere; }
.rs-also { display: inline-flex; gap: 8px; margin-left: 8px; flex-wrap: wrap; }
.rs-foot { margin-top: 24px; }

@media (max-width: 720px) {
  .rs-today { margin-left: 0; width: 100%; }
  .rs-note { font-size: 15px; }
  .rs-reader .rs-head-card, .rs-reader .rs-section { padding: 16px; scroll-margin-top: 110px; }
  .rs-find { top: 46px; }
  .rs-tab { padding: 10px 10px; }
  .rs-sources li { grid-template-columns: 28px 1fr; }
}
