/* research.css — notebooks, all annotations, tags, reading view. Every class starts with "rs-" (see ARCHITECTURE.md). */
.rs .ui-sp { flex: 1; }
.rs-hidden { display: none !important; }
.rs-tabs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: -4px -16px 6px; padding: 2px 16px 8px; }
.rs-tabs::-webkit-scrollbar { display: none; }
.rs-tabs .ui-chip { flex: none; }
.rs-small { font-size: 14.5px; }
.rs-center { text-align: center; }
.rs-ct { font-family: var(--sans); font-size: 12px; font-weight: 600; color: var(--muted); }
.rs-date { font-family: var(--sans); font-size: 12px; color: var(--muted); }
.rs-danger { color: var(--rubric) !important; }
.rs-empty { text-align: center; padding: 18px 10px 8px; color: var(--ink-2); }
.rs-empty p { margin: 0 0 12px; }
.rs-tools { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; align-items: center; }
.rs-hint { min-height: 1.3em; }
.rs-ib { border: 0; background: transparent; width: 34px; height: 34px; border-radius: 9px; cursor: pointer; color: var(--ink-2); font-family: var(--sans); font-size: 17px; line-height: 1; display: inline-grid; place-items: center; flex: none; padding: 0; }
.rs-ib:hover:not(:disabled) { background: var(--surface-3); color: var(--ink); }
.rs-ib:disabled { opacity: .3; cursor: default; }
.rs-ib:focus-visible, .rs-grip:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }

/* overview */
.rs-quick { flex-wrap: wrap; margin: 4px 0 16px; }
.rs-quick .ui-field { flex: 1 1 12rem; }
.rs-quick .rs-hint { flex-basis: 100%; margin: 0 2px; }
.rs-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 0 0 16px; }
.rs-stat { display: flex; flex-direction: column; align-items: center; padding: 10px 4px 9px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); text-decoration: none; color: var(--ink); min-width: 0; }
.rs-stat:hover { border-color: var(--gold-2); }
.rs-stat b { font-family: var(--display); font-size: 30px; font-weight: 600; line-height: 1; color: var(--rubric); font-variant-numeric: lining-nums; }
.rs-stat span { font-family: var(--sans); font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-top: 4px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rs-cols { display: grid; gap: 14px; }
.rs-col { display: grid; gap: 14px; align-content: start; min-width: 0; }
@media (min-width: 900px) { .rs-cols { grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 18px; } .rs-col { gap: 18px; } }
.rs-sec { padding: 16px 16px 14px; }
.rs-h { display: flex; align-items: center; gap: 6px; margin: 0 0 10px; flex-wrap: wrap; }
.rs-h h2 { font-family: var(--display); font-weight: 600; font-size: 24px; margin: 0; line-height: 1.1; }
.rs-nbgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.rs-nbcard { position: relative; display: flex; flex-direction: column; border-radius: 12px; background: var(--surface-2); color: var(--ink); overflow: hidden; min-height: 92px; border: 1px solid transparent; min-width: 0; }
.rs-nbcard::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--nb); }
.rs-nbcard:hover { border-color: color-mix(in srgb, var(--nb) 45%, transparent); }
.rs-nbcard.is-cur { border-color: color-mix(in srgb, var(--nb) 70%, transparent); box-shadow: 0 0 0 1px color-mix(in srgb, var(--nb) 40%, transparent); }
.rs-nbcard.is-drag { box-shadow: var(--shadow-lg); z-index: 5; opacity: .96; }
.rs-nblink { display: flex; flex-direction: column; gap: 3px; padding: 12px 12px 4px 16px; text-decoration: none; color: inherit; flex: 1; min-width: 0; }
.rs-nblink b { font-family: var(--display); font-size: 21px; font-weight: 600; line-height: 1.15; overflow-wrap: anywhere; }
.rs-nblink:hover b { color: var(--rubric); }
.rs-nbmeta { font-family: var(--sans); font-size: 12px; color: var(--muted); }
.rs-nbpeek { font-size: 13.5px; color: var(--ink-2); font-variant: small-caps; letter-spacing: .02em; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; margin-top: 2px; overflow-wrap: anywhere; }
.rs-nbpeek.is-empty { font-variant: normal; font-style: italic; color: var(--muted); }
.rs-nbfoot { display: flex; align-items: center; gap: 4px; padding: 2px 6px 6px 12px; min-height: 36px; }
.rs-nbfoot .ui-btn.is-small { padding: 4px 8px; font-size: 12px; }
.rs-nbcur { font-family: var(--sans); font-size: 12px; font-weight: 700; color: var(--nb); padding-left: 4px; }
.rs-nbcur::before { content: "● "; }
.rs-nbgrid.is-arrange .rs-nbcard { padding-left: 22px; }
.rs-nbgrid.is-arrange .rs-nblink { padding-left: 4px; }
.rs-nbgrip { position: absolute; left: 6px; top: 8px; bottom: 8px; width: 20px !important; }
.rs-rows { list-style: none; margin: 0; padding: 0; }
.rs-rows li { border-top: 1px solid var(--border); }
.rs-rows li:first-child { border-top: 0; }
.rs-rows a { display: flex; align-items: baseline; gap: 10px; padding: 8px 0; text-decoration: none; color: var(--ink); min-width: 0; }
.rs-rows a:hover .rs-t { color: var(--rubric); }
.rs-t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 16.5px; }
.rs-r { color: var(--rubric); font-variant: small-caps; letter-spacing: .03em; white-space: nowrap; font-size: 15.5px; max-width: 45%; overflow: hidden; text-overflow: ellipsis; }
.rs-r.rs-date { font-variant: normal; color: var(--muted); font-size: 12.5px; letter-spacing: 0; }
.rs-k { width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--surface-3); align-self: center; }
.rs-k-ul { background: var(--ul-red); height: 3px; border-radius: 2px; }
.rs-k-note { background: var(--gold); }
.rs-k-xref { background: transparent; border: 2px solid var(--gold); width: 10px; height: 10px; }
.rs-kc-yellow { background: var(--sw-yellow); } .rs-kc-green { background: var(--sw-green); } .rs-kc-blue { background: var(--sw-blue); } .rs-kc-rose { background: var(--sw-rose); } .rs-kc-violet { background: var(--sw-violet); }
.rs-pins { display: grid; gap: 8px; margin-bottom: 10px; }
.rs-pins:empty { display: none; }
.rs-pin { padding: 8px 6px 9px 12px; border-radius: 12px; background: var(--surface-2); min-width: 0; }
.rs-pinh { display: flex; align-items: center; gap: 4px; min-width: 0; }
.rs-pinh a { color: var(--rubric); font-variant: small-caps; letter-spacing: .04em; font-weight: 600; text-decoration: none; font-size: 17.5px; min-width: 0; overflow-wrap: anywhere; }
.rs-pv { font-size: 15.5px; line-height: 1.45; color: var(--ink-2); margin: 2px 6px 0 0; }
.rs-pinform { margin-top: 6px; }
.rs-pinform .ui-field { font-size: 16px; padding: 8px 12px; }
.rs-cloud { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; }
.rs-cloud a { color: var(--ink); text-decoration: none; font-family: var(--serif); line-height: 1.35; overflow-wrap: anywhere; }
.rs-cloud a:hover { color: var(--rubric); }
.rs-cloud sup { font-family: var(--sans); font-size: 10px; color: var(--muted); margin-left: 2px; }

/* all annotations */
.rs-search { margin-bottom: 8px; }
.rs-chips { margin: 8px 0 0; }
.rs-filters { margin: 10px 0 4px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.rs-filters > summary { cursor: pointer; list-style: none; padding: 9px 12px; font-family: var(--sans); font-size: 13px; font-weight: 650; color: var(--ink-2); display: flex; align-items: center; gap: 8px; }
.rs-filters > summary::-webkit-details-marker { display: none; }
.rs-filters > summary::before { content: "›"; color: var(--gold); font-size: 17px; transition: transform .15s; display: inline-block; }
.rs-filters[open] > summary::before { transform: rotate(90deg); }
.rs-badge:not(:empty) { background: var(--rubric); color: var(--on-rubric); border-radius: 999px; font-size: 11px; padding: 0 7px; line-height: 18px; }
.rs-selects { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 10px; padding: 0 12px 12px; }
@media (min-width: 900px) { .rs-selects { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.rs-sel { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.rs-sel span { font-family: var(--sans); font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.rs-sel select { font-family: var(--sans); font-size: 14px; padding: 7px 8px; border-radius: 9px; border: 1px solid var(--border-2); background: var(--surface); color: var(--ink); min-width: 0; width: 100%; }
.rs-listbar { display: flex; align-items: center; gap: 8px; margin: 12px 0 10px; flex-wrap: wrap; }
.rs-count { font-family: var(--sans); font-size: 13px; color: var(--muted); }
.rs-list { display: grid; gap: 10px; }
.rs-ann { padding: 12px 14px 8px; }
.rs-ah { display: flex; align-items: center; gap: 8px; min-width: 0; flex-wrap: wrap; }
.rs-aref { color: var(--rubric); font-variant: small-caps; letter-spacing: .04em; font-weight: 600; font-size: 18px; text-decoration: none; overflow-wrap: anywhere; }
.rs-aref:hover { text-decoration: underline; }
.rs-read { font-family: var(--sans); font-size: 11.5px; color: var(--muted); text-decoration: none; }
.rs-read:hover { color: var(--rubric); }
.rs-aq { margin: 6px 0 2px; font-size: 17.5px; line-height: 1.5; }
.rs-abody { margin-top: 6px; font-size: 16.5px; line-height: 1.5; }
.rs-atext { white-space: pre-wrap; overflow-wrap: anywhere; }
.rs-to { color: var(--rubric); text-decoration: none; font-variant: small-caps; letter-spacing: .03em; }
.rs-ameta { display: flex; align-items: center; gap: 4px 6px; flex-wrap: wrap; margin-top: 8px; }
.rs-ameta .ui-btn.is-small { padding: 4px 7px; font-size: 12px; }
.rs-src-cat { border-left: 3px solid var(--gold-2); }
.rs-src-lib { border-left: 3px solid color-mix(in srgb, var(--rubric) 55%, transparent); }
.rs-src-words { border-left: 3px solid color-mix(in srgb, var(--link) 55%, transparent); }
.rs-cb { width: 18px; height: 18px; accent-color: var(--rubric); flex: none; margin: 0; cursor: pointer; }
.rs-group { margin-top: 18px; display: grid; gap: 10px; }
.rs-gh { display: flex; align-items: center; gap: 8px; font-family: var(--display); font-size: 23px; font-weight: 600; margin: 0; border-bottom: 1px solid var(--border); padding-bottom: 4px; min-width: 0; }
.rs-gh > span:first-child { overflow-wrap: anywhere; min-width: 0; }
.rs-gh .ui-btn { margin-left: auto; }
.rs-bulk { position: sticky; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 30; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 12px; padding: 10px 12px; border-radius: 14px; background: var(--ink); color: var(--paper); box-shadow: var(--shadow-lg); font-family: var(--sans); font-size: 14px; }
@media (max-width: 999px) { .rs-bulk { margin-left: 56px; } }
.rs-bulk .rs-bulkclear { background: transparent; color: var(--paper); border-color: color-mix(in srgb, var(--paper) 40%, transparent); }
.rs-bulk .ui-field { flex: 1 1 8rem; min-width: 0; font-size: 15px; padding: 6px 10px; }
.rs-exports { margin-top: 20px; }

/* tags */
.rs-tags { padding: 4px 14px; }
.rs-tagrow { display: flex; align-items: center; gap: 6px 10px; padding: 8px 0; border-top: 1px solid var(--border); flex-wrap: wrap; }
.rs-tagrow:first-child { border-top: 0; }
.rs-tagname { font-size: 18px; color: var(--ink); text-decoration: none; font-weight: 600; overflow-wrap: anywhere; min-width: 0; }
.rs-tagname:hover { color: var(--rubric); }
.rs-inline { flex: 1 1 10rem; font-size: 16px; padding: 6px 10px; }

/* notebook */
.rs-crumb { font-family: var(--sans); font-size: 12.5px; color: var(--muted); margin: 0; }
.rs-crumb a { color: var(--muted); }
.rs-nbhead { position: relative; padding: 4px 0 4px 16px; margin: 6px 0 14px; }
.rs-nbhead::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 8px; width: 5px; border-radius: 3px; background: var(--nb); }
.rs-nbtitle { cursor: text; margin: 0; }
.rs-nbtitle:hover { text-decoration: underline dotted var(--faint); text-underline-offset: .15em; }
.rs-titleinp { font-family: var(--display); font-size: 30px; font-weight: 600; width: 100%; padding: 4px 10px; }
.rs-nbmetaline { font-family: var(--sans); margin: 4px 0 8px; font-size: 13px; color: var(--muted); }
.rs-swatches { display: flex; gap: 8px; margin: 6px 0 2px; flex-wrap: wrap; }
.rs-sw { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--border-2); background: var(--c); cursor: pointer; padding: 0; }
.rs-sw.is-on { box-shadow: 0 0 0 2px var(--ink); }
.rs-sw:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.rs-addbar { padding: 12px; margin-bottom: 14px; }
@media (min-width: 700px) and (min-height: 600px) { .rs-addbar { position: sticky; top: calc(var(--nxh) + 6px); z-index: 20; } }
.rs-addbar .ui-goto { margin-top: 0; }
.rs-addbar .ui-field { font-size: 17px; padding: 8px 12px; }
.rs-addbar .rs-tools { margin-top: 8px; }
.rs-items { display: grid; gap: 10px; }
.rs-item { display: flex; gap: 2px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); padding: 10px 10px 6px 4px; min-width: 0; transition: box-shadow .15s, transform .15s; }
.rs-item.rs-k-text { background: color-mix(in srgb, var(--nb) 7%, var(--surface)); border-color: color-mix(in srgb, var(--nb) 22%, transparent); }
.rs-item.is-drag { box-shadow: var(--shadow-lg); transform: scale(1.01); position: relative; z-index: 5; opacity: .96; }
.rs-item.is-moved { animation: rs-flash 1.2s ease-out; }
@keyframes rs-flash { 0% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--nb) 45%, transparent); } 100% { box-shadow: var(--shadow); } }
body.rs-dragging { user-select: none; -webkit-user-select: none; cursor: grabbing; }
.rs-grip { flex: none; width: 26px; border: 0; background: none; color: var(--faint); cursor: grab; touch-action: none; display: flex; align-items: flex-start; justify-content: center; padding: 6px 0 0; border-radius: 8px; }
.rs-grip:hover { color: var(--gold); background: var(--surface-3); }
.rs-ibody { flex: 1; min-width: 0; }
.rs-ihead { display: flex; align-items: baseline; gap: 4px 8px; flex-wrap: wrap; }
.rs-ik { font-family: var(--sans); font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--gold); }
.rs-it { color: var(--rubric); font-variant: small-caps; letter-spacing: .04em; font-weight: 600; font-size: 19px; text-decoration: none; overflow-wrap: anywhere; }
.rs-it:hover { text-decoration: underline; }
.rs-q { margin: 6px 0 2px; padding: 0 0 0 12px; border-left: 2px solid color-mix(in srgb, var(--nb, var(--gold-2)) 55%, transparent); font-size: 17.5px; line-height: 1.5; color: var(--ink); overflow-wrap: anywhere; }
.rs-q p { margin: 0 0 .25em; }
.rs-qh { font-family: var(--sans); font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.rs-vn { font-family: var(--sans); font-size: .58em; font-weight: 700; color: var(--rubric); margin-right: .25em; vertical-align: .5em; line-height: 0; }
.rs-qmore { margin-top: 2px; }
.rs-q.rs-clamp { max-height: 13.5em; overflow: hidden; position: relative; }
.rs-q.rs-clamp::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 4.5em; background: linear-gradient(transparent, var(--surface)); pointer-events: none; }
.rs-q.rs-clamp .rs-qmore { position: absolute; bottom: 0; left: 8px; z-index: 1; background: var(--surface); }
.rs-loading { border-left-color: var(--border); }
.rs-tagline { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.rs-inote, .rs-md { font-size: 17px; line-height: 1.55; overflow-wrap: anywhere; }
.rs-inote { margin-top: 8px; padding: 8px 12px; background: var(--surface-2); border-radius: 10px; }
.rs-inote > :first-child, .rs-md > :first-child { margin-top: 0; }
.rs-inote > :last-child, .rs-md > :last-child { margin-bottom: 0; }
.rs-md p, .rs-inote p { margin: 0 0 .55em; }
.rs-md ul, .rs-md ol, .rs-inote ul, .rs-inote ol { margin: .2em 0 .6em; padding-left: 1.3em; }
.rs-md li::marker, .rs-inote li::marker { color: var(--rubric); }
.rs-md blockquote, .rs-inote blockquote { margin: .3em 0 .6em; padding-left: 12px; border-left: 2px solid var(--gold-2); color: var(--ink-2); font-style: italic; }
.rs-md h4, .rs-inote h4 { font-family: var(--display); font-size: 21px; font-weight: 600; margin: .4em 0 .2em; }
.rs-md h4.rs-h1 { font-size: 26px; } .rs-md h4.rs-h2 { font-size: 23px; } .rs-md h4.rs-h4 { font-size: 18px; }
.rs-wl { color: var(--rubric); font-variant: small-caps; letter-spacing: .03em; text-decoration: none; border-bottom: 1px dotted var(--gilt); }
.rs-ta { font-size: 17px; min-height: 130px; margin-top: 4px; }
.rs-ta.is-small { min-height: 80px; font-size: 16px; }
.rs-noteedit { margin-top: 8px; display: grid; gap: 6px; justify-items: start; }
.rs-if { display: flex; align-items: center; gap: 2px; margin-top: 6px; flex-wrap: wrap; }
.rs-if .ui-btn.is-small { padding: 4px 8px; font-size: 12px; }
.rs-rm:hover:not(:disabled) { color: var(--rubric); }

/* sheets & pickers */
.rs-dlg { display: grid; gap: 10px; }
.rs-what { margin: 0; overflow-wrap: anywhere; }
.rs-pick { display: grid; gap: 6px; }
.rs-pickrow { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; border: 1px solid var(--border); background: var(--surface); color: var(--ink); border-radius: 12px; padding: 10px 12px; cursor: pointer; font: inherit; font-size: 17px; min-width: 0; }
.rs-pickrow:hover { border-color: var(--gold-2); background: var(--surface-2); }
.rs-pickrow.is-on, .rs-pickrow.is-cur { border-color: var(--nb, var(--gold)); box-shadow: inset 3px 0 0 var(--nb, var(--gold)); }
.rs-pickrow b { flex: 1; font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.rs-pickct { font-family: var(--sans); font-size: 12px; color: var(--muted); white-space: nowrap; }
.rs-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--nb, var(--gold)); flex: none; }
.rs-newnb .ui-goto { margin-top: 4px; }
.rs-newnb .ui-field { font-size: 16px; padding: 8px 12px; }
.rs-ell { display: inline-block; max-width: 12em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.rs-apick { max-height: 50vh; overflow-y: auto; border: 1px solid var(--border); border-radius: 12px; }
.rs-apick-empty { padding: 12px; margin: 0; }
.rs-arow { display: flex; gap: 10px; align-items: flex-start; padding: 9px 12px; border-top: 1px solid var(--border); cursor: pointer; font-size: 15.5px; line-height: 1.35; color: var(--ink); }
.rs-arow:first-child { border-top: 0; }
.rs-arow.is-have { opacity: .6; }
.rs-arow input { margin-top: 3px; accent-color: var(--rubric); flex: none; }
.rs-arow-b { min-width: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 6px; }
.rs-arow b { color: var(--rubric); font-variant: small-caps; overflow-wrap: anywhere; }
.rs-arow .ui-kind { font-size: 10px; }
.rs-arow-t { flex-basis: 100%; color: var(--ink-2); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }

/* reading & print */
.rs-reading { margin-top: 14px; }
.rs-rhead { text-align: center; padding: 18px 0 4px; }
.rs-rhead h1 { font-family: var(--display); font-size: 40px; font-weight: 600; margin: 6px 0 0; line-height: 1.1; overflow-wrap: anywhere; }
.rs-rsec { margin: 22px 0; }
.rs-rsec h2 { font-size: 20px; margin: 0 0 6px; font-variant: small-caps; letter-spacing: .05em; font-weight: 600; }
.rs-rsec h2 a { color: var(--rubric); text-decoration: none; }
.rs-rtext { margin: 18px 0; font-size: 18px; }
.rs-reading .rs-q { font-size: 18.5px; }
@media (max-width: 520px) { .rs-stat b { font-size: 26px; } .rs-stat span { font-size: 10px; letter-spacing: .04em; } .rs-rhead h1 { font-size: 32px; } }
@media print {
  .rs-noprint, .rs-tabs, .ra-bar, .ra-mini { display: none !important; }
  .rs-readpage { max-width: none; padding: 0; }
  .rs-reading .rs-q { font-size: 12pt; border-left-color: #999; }
  .rs-rsec { break-inside: avoid-page; }
  .rs-rsec h2 a, .rs-wl { color: #7a1d14; }
}
.rs-addbar .rs-hint:empty { display: none; }
.rs-collect[aria-pressed="true"] { color: var(--ink); font-weight: 700; }
@media (max-width: 420px) { .rs-stat span { font-size: 9.5px; letter-spacing: .02em; } }
