/* Quiet, readable research workspace; isolated from the document canvas. */
.reference-library{--rl-ink:#203b4c;--rl-muted:#667f90;--rl-line:#dfe8ed;--rl-accent:#007f91;box-sizing:border-box;width:min(1540px,96vw);height:min(920px,94dvh);max-width:none;max-height:none;padding:0;border:1px solid #d7e5ed;border-radius:22px;color:var(--rl-ink);background:#fff;box-shadow:0 24px 100px #102d493d;font:14px/1.5 system-ui,-apple-system,"Segoe UI",sans-serif;overflow:hidden}
.reference-library[open]{display:flex;flex-direction:column}.reference-library::backdrop,.rl-editor::backdrop{background:#20384c59;backdrop-filter:blur(5px)}
.reference-library *,.rl-editor *{box-sizing:border-box}.reference-library button,.reference-library select,.reference-library input,.rl-editor button,.rl-editor input,.rl-editor textarea,.rl-editor select{font:inherit;color:inherit}
.reference-library button,.rl-editor button{border:1px solid var(--rl-line,#dfe8ed);background:#fff;border-radius:9px;padding:8px 12px;cursor:pointer;line-height:1.4;transition:background .15s,border-color .15s}
.reference-library button:hover,.rl-editor button:hover{background:#eef7f8;border-color:#a2cbd3}.reference-library :focus-visible,.rl-editor :focus-visible{outline:3px solid #50b4c7;outline-offset:2px}
.reference-library .rl-primary,.rl-editor .rl-primary{color:#fff;background:#007f91;border-color:#007f91}.reference-library .rl-primary:hover{background:#006b7b}
.rl-header{display:flex;justify-content:space-between;align-items:center;gap:24px;padding:24px 28px;border-bottom:1px solid var(--rl-line);background:linear-gradient(115deg,#f0f8f9,#fff 72%)}
.rl-eyebrow{color:#15879a;font-size:10px;font-weight:750;letter-spacing:.16em}.rl-header h1{font-size:24px;line-height:1.25;margin:4px 0 0;max-width:600px;overflow-wrap:anywhere}.rl-header-actions,.rl-actions,.rl-cite-actions{display:flex;flex-wrap:wrap;gap:7px}
.rl-workspace{min-height:0;flex:1;display:grid;grid-template-columns:195px minmax(300px,1fr) minmax(270px,340px)}.rl-sidebar{padding:18px 14px;background:#f7fafb;border-right:1px solid var(--rl-line);overflow:auto}.rl-sidebar label{font-size:12px;font-weight:650;color:var(--rl-muted)}
.rl-sidebar select,.rl-toolbar input,.rl-editor input,.rl-editor select,.rl-editor textarea{width:100%;border:1px solid #d4e0e7;border-radius:8px;padding:10px;background:#fff}.rl-sidebar select{margin-top:7px}.rl-side-actions,.rl-collections,.rl-side-footer{display:flex;flex-direction:column;gap:5px;margin:17px 0}.rl-sidebar button{text-align:left;background:transparent;border-color:transparent;font-size:12px;padding:8px}.rl-sidebar button.active{background:#e5f2f4;color:#006c7e;font-weight:700}.rl-collections{border-top:1px solid var(--rl-line);padding-top:16px}.rl-side-footer{border-top:1px solid var(--rl-line);padding-top:15px;font-size:12px;color:var(--rl-muted);gap:12px}.rl-side-footer details button{display:block;width:100%}.rl-side-footer small{font-size:10px}.reference-library a{color:#00758a;text-decoration:none}.reference-library a:hover{text-decoration:underline}
.rl-content{display:flex;min-width:0;min-height:0;flex-direction:column}.rl-toolbar{padding:16px 18px 0;border-bottom:1px solid var(--rl-line)}.rl-toolbar input{background:#f6f9fb}.rl-toolbar nav{display:flex;gap:15px;margin-top:11px}.rl-toolbar nav button{border:0;border-bottom:3px solid transparent;border-radius:0;padding:10px 5px;color:var(--rl-muted)}.rl-toolbar nav button.active{border-color:var(--rl-accent);color:var(--rl-accent);font-weight:700}.rl-main{overflow:auto;min-height:0;flex:1}.rl-list-top{display:flex;flex-wrap:wrap;align-items:center;gap:8px;padding:13px 18px;border-bottom:1px solid #edf2f5;font-size:12px}.rl-list-top strong{margin-right:auto}.rl-list-top button{font-size:12px;padding:6px 9px}.rl-list-top select{max-width:180px;border:1px solid var(--rl-line);border-radius:8px;padding:6px;background:#fff}
.rl-items{padding:8px}.rl-item{display:grid!important;width:100%;text-align:left;padding:14px!important;border:1px solid transparent!important;gap:4px;margin:3px 0}.rl-item.selected{background:#eaf5f7!important;border-color:#a5cdd5!important}.rl-item strong{font-size:14px;line-height:1.45;overflow-wrap:anywhere}.rl-item small{color:var(--rl-muted);font-size:11px}.rl-type{font-size:10px;letter-spacing:.05em;color:#678092}.rl-empty{text-align:center;padding:65px 26px;color:var(--rl-muted)}.rl-empty h2{color:var(--rl-ink);font-size:23px;line-height:1.5}.rl-empty p{line-height:1.8}.rl-empty button{margin:12px 5px}
.rl-detail{border-left:1px solid var(--rl-line);padding:23px;overflow:auto;overflow-wrap:anywhere;min-width:0}.rl-detail h2{font-size:21px;line-height:1.4;margin:7px 0 18px}.rl-detail h3{font-size:15px;margin-top:23px}.rl-detail h4{font-size:11px;color:var(--rl-muted);margin:17px 0 3px}.rl-field{font-size:13px;margin:0;white-space:pre-wrap}.rl-actions button{padding:6px 9px;font-size:11px}.rl-external{display:flex;flex-wrap:wrap;gap:12px;font-size:12px;margin:18px 0}.rl-muted{font-size:12px;color:var(--rl-muted);padding:8px 18px}.rl-detail .rl-muted{padding:5px 0}.rl-related{display:block;width:100%;text-align:left;font-size:12px!important;margin:6px 0}.rl-note{font-size:13px;border-left:2px solid #8cbcc6;padding-left:13px}.rl-note pre{white-space:pre-wrap}.rl-note table{max-width:100%;border-collapse:collapse}.rl-note td,.rl-note th{border:1px solid var(--rl-line);padding:4px}.rl-highlight{background:#fff3b3}.rl-conflict{padding:12px;background:#fff7e5;border-radius:10px;font-size:12px}.rl-conflict button{margin-top:8px}
.rl-graph{width:100%;min-height:400px;display:block;background:radial-gradient(#adc5d04d 1px,transparent 1px);background-size:20px 20px}.rl-graph [role=button]{cursor:pointer}.rl-graph [role=button]:hover circle{stroke:#007f91;stroke-width:3}.rl-mindmap{padding:35px;overflow:auto;min-height:400px;background:#fafdfe}.rl-branch{display:flex;align-items:center;gap:22px;padding:12px 0}.rl-branches{border-left:1px solid #bad2dd;padding-left:22px}.rl-map-card{flex-shrink:0;max-width:240px;background:#fff;border:1px solid #cedfe6;border-radius:12px;padding:8px;box-shadow:0 3px 10px #15334908}.rl-map-card.selected{border-color:#15879a;background:#edf8f9}.rl-map-card button{border:0;background:transparent;display:block;font-size:12px;text-align:left}.rl-map-card button+button{color:#007f91;font-size:10px}
.rl-footer{display:flex;align-items:center;gap:14px;padding:14px 23px;border-top:1px solid var(--rl-line);background:#fbfcfd;font-size:12px}.rl-status{margin:0;flex:1;color:var(--rl-muted);overflow-wrap:anywhere}.rl-status.error{color:#af3434}.rl-footer label{white-space:nowrap}.rl-footer select{border:1px solid var(--rl-line);border-radius:7px;padding:6px;background:#fff}.rl-cite-actions button{font-size:12px}.rl-busy .rl-workspace,.rl-busy .rl-footer label,.rl-busy .rl-cite-actions,.rl-busy .rl-header-actions button:not(:last-child){pointer-events:none;opacity:.65}.rl-busy .rl-status{color:#007f91}
.rl-editor{width:min(620px,94vw);max-height:90dvh;border:1px solid #d5e3ea;border-radius:18px;padding:25px;color:#203b4c;box-shadow:0 25px 90px #102d494d;font:14px/1.5 system-ui}.rl-editor h3{margin:0 0 18px;font-size:20px}.rl-editor label{display:block;margin:13px 0;font-size:12px;font-weight:600}.rl-editor input,.rl-editor textarea,.rl-editor select{margin-top:5px;font-weight:400}.rl-editor textarea{min-height:82px;resize:vertical}.rl-editor footer{display:flex;justify-content:flex-end;gap:10px;padding-top:15px}
.reference-citation{color:#087d98;cursor:pointer}.reference-bibliography{font-size:.92em}.reference-bibliography>div>div{margin:8px 0}
@media(max-width:1050px){.rl-workspace{grid-template-columns:155px minmax(260px,1fr) 260px}.rl-header{padding:17px}.rl-detail{padding:16px}.rl-header h1{font-size:21px}.rl-header-actions button{padding:7px;font-size:12px}.rl-footer{flex-wrap:wrap}.rl-status{flex-basis:100%}}
@media(max-width:760px){.reference-library{width:100vw;height:100dvh;border-radius:0}.rl-header{align-items:flex-start;gap:10px}.rl-header h1{font-size:18px}.rl-header .rl-eyebrow{font-size:8px}.rl-header-actions{justify-content:flex-end}.rl-workspace{display:flex;overflow:auto;flex-direction:column}.rl-sidebar{padding:10px 14px;overflow:visible;border-right:0}.rl-sidebar label{display:flex;align-items:center;gap:12px}.rl-sidebar select{margin:0;width:auto;max-width:75%}.rl-side-actions,.rl-collections{flex-direction:row;overflow:auto;flex-wrap:nowrap;margin:8px 0;padding:0;border:0}.rl-sidebar button{white-space:nowrap}.rl-side-footer{display:none}.rl-content{min-height:380px;overflow:visible;flex-shrink:0}.rl-main{max-height:420px}.rl-detail{border-left:0;border-top:1px solid var(--rl-line);overflow:visible}.rl-footer{padding:10px 14px;gap:8px}.rl-graph{min-height:300px}.rl-empty{padding:25px}.rl-toolbar{padding-top:10px}}

/* Final UI pass: quiet hierarchy, stronger focus states, and a polished mobile collapse. */
.reference-library {
  position:fixed;
  inset:0;
  margin:auto;
  --rl-ink:#16364b;
  --rl-muted:#6b8290;
  --rl-line:#d8e6ec;
  --rl-accent:#0b879b;
  --rl-accent-dark:#066779;
  width:min(1480px,calc(100vw - 32px));
  height:min(900px,calc(100dvh - 32px));
  border:1px solid #cfe1e9;
  border-radius:26px;
  background:linear-gradient(145deg,#ffffff 0%,#fbfeff 62%,#f3fafb 100%);
  box-shadow:0 28px 100px #0d2c4238,0 4px 16px #0d2c4212;
}
.reference-library button,.rl-editor button {
  min-height:36px;
  border-radius:11px;
  transition:transform .16s ease,background .16s ease,border-color .16s ease,box-shadow .16s ease;
}
.reference-library button:hover,.rl-editor button:hover { box-shadow:0 5px 16px #0b647014; transform:translateY(-1px); }
.reference-library button:active,.rl-editor button:active { transform:translateY(0); box-shadow:none; }
.reference-library .rl-primary,.rl-editor .rl-primary {
  background:linear-gradient(135deg,#0794a7,#08758a);
  box-shadow:0 8px 20px #08758a2b;
}
.rl-header {
  position:relative;
  padding:22px 28px;
  background:linear-gradient(116deg,#eef9fa 0%,#fff 58%,#f8f7ff 100%);
  overflow:hidden;
}
.rl-header::after {
  content:"";
  position:absolute;
  width:180px;
  height:180px;
  right:-72px;
  top:-92px;
  border-radius:50%;
  background:#bdeaf044;
  pointer-events:none;
}
.rl-header h1 { letter-spacing:-.015em; }
.rl-header-actions { position:relative; z-index:1; align-items:center; }
.rl-header-actions button { padding:8px 14px; font-size:12px; }
.rl-header-actions button:last-child { border-color:#b7d2dc; background:#f7fbfc; }
.rl-workspace { grid-template-columns:218px minmax(360px,1fr) minmax(300px,360px); }
.rl-sidebar {
  padding:20px 15px;
  background:linear-gradient(180deg,#f4fafb,#f9fbfc 62%,#f4f8fa);
}
.rl-sidebar select { border-color:#c7dce4; box-shadow:0 2px 6px #17465b08; }
.rl-sidebar button { border-radius:10px; }
.rl-sidebar button.active { box-shadow:inset 3px 0 var(--rl-accent),0 4px 12px #11798c10; }
.rl-content { background:#fff; }
.rl-toolbar {
  padding:15px 20px 0;
  background:#ffffffee;
  backdrop-filter:blur(12px);
}
.rl-toolbar input { min-height:42px; border-radius:12px; padding-inline:13px; background:#f7fafb; }
.rl-toolbar input:focus { background:#fff; border-color:#73bdc9; box-shadow:0 0 0 4px #73bdc91f; }
.rl-toolbar nav { gap:4px; margin-top:12px; }
.rl-toolbar nav button { min-height:39px; padding:9px 14px; border-radius:10px 10px 0 0; }
.rl-toolbar nav button.active { background:#edf8f9; }
.rl-items { padding:10px 12px 18px; }
.rl-item { border-radius:14px !important; padding:13px 14px !important; }
.rl-item:hover { background:#f6fbfc !important; border-color:#d1e7ec !important; }
.rl-item.selected { box-shadow:0 7px 18px #0b718c12; }
.rl-detail { padding:24px 22px; background:linear-gradient(180deg,#fcfeff,#f8fbfc); }
.rl-detail h2 { letter-spacing:-.012em; }
.rl-actions { gap:6px; }
.rl-actions button { border-radius:9px; }
.rl-external a { padding:5px 9px; border:1px solid #cde1e6; border-radius:9px; background:#f8fcfd; }
.rl-external a:hover { background:#eaf7f8; text-decoration:none; }
.rl-empty { margin:18px 10px; border:1px dashed #bfdbe3; border-radius:18px; background:linear-gradient(145deg,#f5fbfc,#fff); }
.rl-empty h2 { color:#16455a; letter-spacing:-.02em; }
.rl-graph { border:1px solid #e1edf1; border-radius:16px; background-color:#fbfeff; }
.rl-map-card { border-color:#d4e5ea; box-shadow:0 6px 16px #16445a0b; }
.rl-map-card.selected { box-shadow:0 7px 18px #0b879b1c; }
.rl-footer { padding:13px 22px; background:#fafdfe; }
.rl-status { font-variant-numeric:tabular-nums; }
@media (max-width:1050px) {
  .rl-workspace { grid-template-columns:160px minmax(0,1fr) 240px; }
}
.rl-editor{position:fixed;inset:0;margin:auto;overflow:auto}
.reference-library .rl-header,.reference-library .rl-footer{flex-shrink:0}
.reference-library .rl-side-footer summary{cursor:pointer;min-height:32px;display:flex;align-items:center}
@media (max-width:760px){.rl-side-footer{display:flex;flex-direction:row;flex-wrap:wrap;margin:8px 0 0;padding:6px 0 0;gap:6px 16px}.rl-side-footer small{display:none}.rl-side-footer details[open]{width:100%}.rl-header>div:first-child{min-width:0}.rl-header-actions{flex-shrink:0;max-width:58%}}
@media (prefers-reduced-motion:reduce){.reference-library button,.rl-editor button{transition:none}.reference-library button:hover,.rl-editor button:hover{transform:none}}
@media (max-width:760px) {
  .reference-library { width:100vw; height:100dvh; border-radius:0; }
  .rl-header { padding:17px 16px; }
  .rl-header-actions { gap:5px; }
  .rl-header-actions button { padding:7px 9px; }
  .rl-sidebar { padding:10px 12px 7px; }
  .rl-toolbar { padding-inline:13px; }
  .rl-detail { padding:18px 15px; }
  .rl-empty { margin:10px 0; }
}
