:root {
  --ink: #102c3a;
  --muted: #637680;
  --paper: #f7f6f1;
  --white: #fff;
  --line: #dce3e3;
  --teal: #0d766e;
  --teal-dark: #075b55;
  --teal-pale: #e4f3ef;
  --gold: #d6a548;
  --shadow: 0 18px 45px rgba(19, 46, 58, .09);
  --radius: 18px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--paper); font-family: "DM Sans", system-ui, sans-serif; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }

.masthead { height: 72px; padding: 0 clamp(20px, 5vw, 76px); display: flex; align-items: center; justify-content: space-between; background: rgba(247,246,241,.92); border-bottom: 1px solid rgba(16,44,58,.1); position: sticky; top: 0; z-index: 20; backdrop-filter: blur(14px); }
.brand { display: flex; gap: 10px; align-items: center; color: var(--ink); text-decoration: none; font-size: 18px; }
.brand-mark { width: 34px; height: 34px; display: grid; place-items: center; background: var(--ink); color: white; border-radius: 50%; font-family: Newsreader, serif; font-size: 22px; }
nav { display: flex; align-items: center; gap: 4px; }
.nav-link { color: var(--muted); background: transparent; border: 0; padding: 10px 13px; border-radius: 9px; }
.nav-link:hover, .nav-link.active { color: var(--ink); background: #e9ece8; }
.count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; margin-left: 3px; padding: 0 5px; background: var(--teal); color: white; border-radius: 20px; font-size: 11px; }

.view { display: none; }
.view.active { display: block; }
.hero { padding: 86px clamp(20px, 8vw, 120px) 55px; background: radial-gradient(circle at 88% 10%, rgba(13,118,110,.13), transparent 25%), linear-gradient(155deg, #f7f6f1 55%, #edf2ed); }
.eyebrow { color: var(--teal); font-size: 12px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; }
h1, h2 { font-family: Newsreader, Georgia, serif; }
h1 { margin: 10px 0 18px; font-size: clamp(44px, 6vw, 76px); font-weight: 500; line-height: .98; letter-spacing: -.035em; }
.hero-copy { max-width: 670px; color: var(--muted); font-size: 17px; line-height: 1.65; }
.search-box { max-width: 930px; margin-top: 34px; display: grid; grid-template-columns: 25px 1fr auto; align-items: center; gap: 12px; padding: 9px 10px 9px 20px; background: white; border: 1px solid var(--line); border-radius: 15px; box-shadow: var(--shadow); }
.search-box svg { width: 22px; fill: none; stroke: var(--muted); stroke-width: 1.8; stroke-linecap: round; }
.search-box input { min-width: 0; border: 0; outline: 0; padding: 12px 4px; color: var(--ink); background: transparent; font-size: 16px; }
button, .button { border: 0; padding: 11px 17px; color: white; background: var(--teal); border-radius: 9px; font-weight: 600; transition: .18s ease; }
button:hover { background: var(--teal-dark); transform: translateY(-1px); }
button.secondary { color: var(--ink); background: white; border: 1px solid var(--line); }
button.secondary:hover { border-color: #a7b6b5; background: #f8faf8; }
.filters { max-width: 930px; display: flex; gap: 18px; margin-top: 18px; flex-wrap: wrap; }
.filters label { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; font-weight: 600; }
select, .filters input { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; color: var(--ink); background: rgba(255,255,255,.65); outline: none; }
.filters input { width: 84px; }
.status { max-width: 1080px; margin: 30px auto 0; padding: 0 24px; min-height: 24px; color: var(--muted); }
.results { max-width: 1080px; margin: 12px auto 80px; padding: 0 24px; display: grid; gap: 13px; }
.result-card, .library-card { position: relative; padding: 24px 26px; background: white; border: 1px solid var(--line); border-radius: 14px; transition: .18s ease; }
.result-card:hover { border-color: #aebfbc; box-shadow: 0 10px 30px rgba(19,46,58,.06); transform: translateY(-2px); }
.result-meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; color: var(--muted); font-size: 12px; }
.pmid { color: var(--teal); background: var(--teal-pale); padding: 3px 7px; border-radius: 5px; font-weight: 700; }
.result-card h2, .library-card h2 { margin: 11px 0 8px; font-size: 23px; line-height: 1.18; }
.authors { margin: 0; color: var(--muted); font-size: 13px; }
.abstract-preview { display: -webkit-box; overflow: hidden; margin: 15px 0; color: #435963; font-size: 14px; line-height: 1.55; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.card-actions { display: flex; gap: 8px; margin-top: 17px; }
.card-actions button { padding: 8px 12px; font-size: 12px; }
.card-actions .text-button { color: var(--teal); background: transparent; padding-left: 0; }
.card-actions .text-button:hover { color: var(--teal-dark); transform: none; }
.source-button { padding: 8px 12px; font-size: 12px; text-decoration: none; }
.source-link { text-decoration: none; }
.saved { color: var(--teal) !important; background: var(--teal-pale) !important; }

.page-view { max-width: 1180px; min-height: calc(100vh - 72px); margin: auto; padding: 60px 28px 100px; }
.wide-page { max-width: 1380px; }
.page-subtitle { max-width: 760px; margin: -10px 0 0; color: var(--muted); font-size: 14px; line-height: 1.65; }
.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 32px; }
.page-heading h1, .narrow h1 { font-size: clamp(42px, 5vw, 62px); }
.heading-actions { display: flex; align-items: center; gap: 9px; }
.empty-state { padding: 90px 20px; text-align: center; background: rgba(255,255,255,.55); border: 1px dashed #bac7c5; border-radius: var(--radius); }
.empty-state h2 { margin-bottom: 6px; font-size: 28px; }
.empty-state p { color: var(--muted); }
.empty-icon { color: var(--teal); font-size: 50px; }
.library-list { display: grid; gap: 13px; }
.library-card { display: grid; grid-template-columns: 1fr auto; gap: 18px; }
.formatted-citation { grid-column: 1 / -1; margin: 5px 0 0; padding: 12px 14px; color: #425760; background: #f3f6f4; border-radius: 8px; font-family: ui-monospace, monospace; font-size: 12px; line-height: 1.5; white-space: pre-wrap; }
.icon-button { align-self: start; color: #9a4747; background: #fbefef; padding: 8px 11px; }
.icon-button:hover { color: white; background: #9a4747; }

.builder-layout { display: grid; grid-template-columns: 230px 1fr; gap: 24px; }
.section-nav { display: flex; flex-direction: column; gap: 5px; }
.section-nav button { text-align: left; color: var(--muted); background: transparent; font-size: 13px; }
.section-nav button:hover, .section-nav button.active { color: var(--ink); background: white; transform: none; box-shadow: 0 3px 12px rgba(19,46,58,.05); }
.editor-card { min-width: 0; background: white; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.editor-head { display: flex; justify-content: space-between; padding: 19px 22px; border-bottom: 1px solid var(--line); }
.editor-head label { font-family: Newsreader, serif; font-size: 23px; }
.editor-head span, .save-state { color: var(--muted); font-size: 12px; }
#section-editor { width: 100%; min-height: 500px; padding: 25px; resize: vertical; border: 0; outline: 0; color: var(--ink); line-height: 1.75; }
.citation-insert { display: flex; gap: 8px; padding: 14px 20px; background: #f7f9f7; border-top: 1px solid var(--line); }
.citation-insert select { flex: 1; min-width: 0; }
.citation-writer { padding: 22px; background: linear-gradient(145deg, #edf6f2, #f7f8f4); border-top: 1px solid #cadfd9; }
.citation-writer-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; }
.citation-writer-head h3 { margin: 3px 0 4px; font: 600 25px Newsreader, serif; }
.citation-writer-head p { margin: 0; color: var(--muted); font-size: 12px; }
.citation-writer-provider { display: flex; gap: 7px; }
.citation-writer-provider select { max-width: 130px; background: white; }
.citation-writer-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(260px, .75fr); gap: 15px; margin-top: 18px; }
.citation-source-column, .sentence-options { padding: 15px; background: rgba(255,255,255,.76); border: 1px solid #d2e1dd; border-radius: 12px; }
.citation-source-column > strong { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; }
#sentence-source-count { color: var(--teal); font-weight: 700; }
.sentence-citation-list { max-height: 260px; margin-top: 10px; overflow: auto; display: grid; gap: 7px; }
.sentence-source { display: grid; grid-template-columns: auto 1fr; gap: 9px; align-items: start; padding: 10px; background: white; border: 1px solid var(--line); border-radius: 9px; cursor: pointer; transition: .15s ease; }
.sentence-source:hover, .sentence-source:has(input:checked) { border-color: var(--teal); background: #eef8f4; }
.sentence-source input { width: 17px; height: 17px; margin-top: 2px; accent-color: var(--teal); }
.sentence-source strong { display: block; overflow: hidden; color: var(--ink); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.sentence-source small { display: block; margin-top: 3px; color: var(--muted); font-size: 9px; }
.citation-writer-empty { padding: 25px 10px; color: var(--muted); text-align: center; font-size: 12px; }
.sentence-options { display: grid; gap: 7px; }
.sentence-options label:not(.context-option) { margin-top: 3px; color: var(--muted); font-size: 10px; font-weight: 700; }
.sentence-options select, .sentence-options textarea { width: 100%; background: white; }
.sentence-options textarea { padding: 10px; resize: vertical; border: 1px solid var(--line); border-radius: 8px; line-height: 1.45; }
.context-option { display: flex; flex-direction: row !important; align-items: flex-start; gap: 7px !important; color: var(--muted); font-size: 10px !important; font-weight: 500 !important; line-height: 1.35; }
.context-option input { width: 15px; height: 15px; flex: 0 0 auto; accent-color: var(--teal); }
.sentence-writer-status { min-height: 0; margin-top: 12px; color: var(--muted); font-size: 12px; }
.sentence-writer-status:not(:empty) { min-height: 42px; padding: 10px 12px; background: rgba(255,255,255,.62); border-radius: 9px; }
.sentence-suggestions { display: grid; gap: 9px; margin-top: 12px; }
.sentence-suggestion { padding: 14px 15px; background: white; border: 1px solid var(--line); border-radius: 11px; }
.sentence-suggestion-text { margin: 0; color: var(--ink); font-family: Newsreader, Georgia, serif; font-size: 18px; line-height: 1.45; }
.sentence-suggestion-note { margin: 9px 0 0; color: var(--muted); font-size: 10px; line-height: 1.45; }
.sentence-suggestion-actions { display: flex; gap: 7px; margin-top: 11px; }
.sentence-suggestion-actions button { padding: 6px 10px; font-size: 10px; }
.citation-trace { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }

.narrow { max-width: 1000px; }
.about-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 45px; }
.about-grid article { padding: 25px; background: white; border: 1px solid var(--line); border-radius: 14px; }
.about-grid span { color: var(--gold); font: 600 22px Newsreader, serif; }
.about-grid h2 { font-size: 23px; }
.about-grid p, .disclaimer { color: var(--muted); font-size: 14px; line-height: 1.65; }
.disclaimer { margin-top: 30px; padding: 18px; border-left: 3px solid var(--gold); background: #fff9ec; }

dialog { width: min(790px, calc(100% - 30px)); max-height: 88vh; padding: 0; color: var(--ink); background: white; border: 0; border-radius: 18px; box-shadow: 0 30px 90px rgba(0,0,0,.28); }
dialog::backdrop { background: rgba(8,28,38,.62); backdrop-filter: blur(3px); }
.dialog-close { position: sticky; float: right; top: 14px; margin: 14px; padding: 4px 12px; color: var(--ink); background: #eef1ef; border-radius: 50%; font-size: 25px; }
#dialog-content { padding: 42px; }
#dialog-content h2 { margin: 8px 0 16px; font-size: 34px; }
#dialog-content h3 { margin-top: 30px; font-family: Newsreader, serif; font-size: 22px; }
#dialog-content p { color: #405761; line-height: 1.7; }
.toast { position: fixed; left: 50%; bottom: 25px; z-index: 50; transform: translate(-50%, 20px); padding: 11px 18px; color: white; background: var(--ink); border-radius: 30px; opacity: 0; pointer-events: none; transition: .25s ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.loader { width: 22px; height: 22px; display: inline-block; margin-right: 10px; vertical-align: middle; border: 3px solid #c8d6d3; border-top-color: var(--teal); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* AI research layer */
.ai-spark { color: var(--gold); }
.ai-config-link { border: 1px solid rgba(13,118,110,.18); }
button.ai-primary { background: linear-gradient(135deg, #0d766e, #0a526c); box-shadow: 0 8px 22px rgba(13,118,110,.18); }
button.ai-primary:hover { background: linear-gradient(135deg, #0a655f, #083f54); }
.library-select { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; color: var(--teal); font-size: 12px; font-weight: 700; }
.library-select input { width: 17px; height: 17px; accent-color: var(--teal); }

.settings-dialog { width: min(860px, calc(100% - 30px)); }
.settings-content { padding: 42px; }
.settings-content h2 { margin: 7px 0 8px; font: 500 40px/1.05 Newsreader, serif; }
.settings-intro { max-width: 690px; margin: 0 0 26px; color: var(--muted); line-height: 1.6; }
.provider-settings { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.provider-settings section { padding: 20px; background: #f7f9f7; border: 1px solid var(--line); border-radius: 14px; }
.provider-settings label { display: block; margin: 15px 0 6px; color: var(--muted); font-size: 12px; font-weight: 700; }
.provider-settings input, .provider-settings select { width: 100%; }
.provider-title { display: flex; justify-content: space-between; align-items: center; }
.provider-title strong { font: 600 23px Newsreader, serif; }
.key-status { padding: 4px 8px; color: var(--muted); background: #e9eeeb; border-radius: 20px; font-size: 10px; }
.key-status.ready { color: #08635d; background: #dcefea; }
.key-row { display: grid; grid-template-columns: 1fr auto; gap: 7px; }
.key-row button { padding: 8px 11px; }
.model-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 7px; }
.model-row button { padding: 8px 10px; }
.settings-note { margin: 12px 0 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.optional { color: var(--muted); font-weight: 500; }
.privacy-callout { margin-top: 16px; padding: 14px 16px; color: #735718; background: #fff7df; border: 1px solid #ead9a9; border-radius: 10px; font-size: 12px; line-height: 1.55; }
.settings-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 20px; }

#article-dialog.ai-open { width: min(1120px, calc(100% - 30px)); }
.ai-reader { margin-top: 32px; padding: 22px; background: linear-gradient(145deg, #edf6f2, #f4f7f4); border: 1px solid #cfe2dd; border-radius: 16px; }
.ai-reader-head { display: flex; justify-content: space-between; gap: 15px; align-items: flex-start; }
.ai-reader-head h3 { margin: 3px 0 5px !important; font-size: 26px !important; }
.ai-reader-head p { margin: 0; color: var(--muted) !important; font-size: 12px; }
.ai-provider-controls { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ai-provider-controls select { max-width: 190px; background: white; }
.ai-task-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; margin-top: 18px; }
.ai-task { min-height: 68px; padding: 11px 13px; text-align: left; color: var(--ink); background: white; border: 1px solid #cfdedb; }
.ai-task:hover { color: white; background: var(--teal); }
.ai-task small { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; font-weight: 500; line-height: 1.3; }
.ai-task:hover small { color: rgba(255,255,255,.78); }
.ai-question-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-top: 9px; }
.ai-question-row input { min-width: 0; padding: 11px 13px; border: 1px solid #cfdedb; border-radius: 9px; outline: 0; }
.supplemental-source { margin-top: 10px; padding: 11px 13px; background: rgba(255,255,255,.62); border: 1px solid #d5e2df; border-radius: 9px; }
.supplemental-source summary { color: var(--teal); cursor: pointer; font-size: 12px; font-weight: 700; }
.supplemental-source textarea { width: 100%; margin-top: 10px; padding: 12px; resize: vertical; border: 1px solid var(--line); border-radius: 8px; line-height: 1.5; }
.ai-output { display: none; margin-top: 18px; background: white; border: 1px solid var(--line); border-radius: 13px; overflow: hidden; }
.ai-output.visible { display: block; }
.ai-output-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 13px 16px; color: white; background: var(--ink); }
.ai-output-head strong { font-size: 13px; }
.ai-output-actions { display: flex; gap: 6px; }
.ai-output-actions button { padding: 5px 9px; color: white; background: rgba(255,255,255,.12); font-size: 10px; }
.ai-output-body { padding: 22px; color: #324b56; font-size: 14px; line-height: 1.7; }
.ai-output-body h2, .ai-output-body h3, .ai-output-body h4 { margin: 22px 0 8px; color: var(--ink); font-family: Newsreader, serif; }
.ai-output-body h2 { font-size: 26px; }
.ai-output-body h3 { font-size: 21px; }
.ai-output-body p { color: #324b56 !important; }
.ai-output-body ul, .ai-output-body ol { padding-left: 22px; }
.ai-output-body code { padding: 2px 5px; background: #eef3f1; border-radius: 4px; }
.source-cite { display: inline-block; padding: 1px 5px; color: #075e58; background: var(--teal-pale); border-radius: 4px; font-size: 11px; font-weight: 700; }
.dual-report { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.model-report { min-width: 0; padding: 15px; border: 1px solid var(--line); border-radius: 10px; }
.model-report > h3 { margin-top: 0; }
.consensus-report { grid-column: 1 / -1; padding: 16px; background: #f2f8f5; border: 1px solid #c8dfd7; border-radius: 10px; }
.ai-loading { display: grid; place-items: center; min-height: 180px; text-align: center; color: var(--muted); }
.ai-loading .loader { width: 34px; height: 34px; margin: 0 0 12px; }
.ai-disclaimer { margin: 12px 0 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.analysis-source-count { color: var(--teal); font-weight: 700; }

/* Research OS */
.os-hero { min-height: 590px; padding: 82px clamp(24px, 7vw, 112px) 66px; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(330px, .65fr); gap: clamp(40px, 7vw, 110px); align-items: center; background: radial-gradient(circle at 72% 18%, rgba(42,166,148,.16), transparent 25%), radial-gradient(circle at 100% 90%, rgba(214,165,72,.11), transparent 28%), linear-gradient(145deg, #f8f7f2, #eaf2ee); border-bottom: 1px solid var(--line); }
.os-hero h1 { max-width: 850px; font-size: clamp(54px, 7vw, 94px); }
.hero-actions { display: flex; gap: 10px; margin-top: 30px; flex-wrap: wrap; }
.system-status { padding: 24px; background: rgba(255,255,255,.84); border: 1px solid rgba(16,44,58,.13); border-radius: 20px; box-shadow: 0 25px 60px rgba(16,44,58,.11); backdrop-filter: blur(10px); }
.status-head { display: flex; align-items: center; gap: 8px; padding-bottom: 17px; border-bottom: 1px solid var(--line); font-size: 12px; }
.status-head span:last-child { margin-left: auto; color: var(--muted); }
.live-dot { width: 8px; height: 8px; background: #25a77d; border-radius: 50%; box-shadow: 0 0 0 5px rgba(37,167,125,.12); }
.metric-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 18px 0; }
.metric-grid div { padding: 14px; background: #f4f7f4; border: 1px solid #e0e7e4; border-radius: 12px; }
.metric-grid strong { display: block; font: 600 32px/1 Newsreader, serif; }
.metric-grid span { color: var(--muted); font-size: 10px; }
.system-ledger { display: grid; gap: 9px; }
.system-ledger p { display: flex; justify-content: space-between; gap: 12px; margin: 0; font-size: 10px; }
.system-ledger span { color: var(--muted); }
.system-ledger strong { text-align: right; }
.os-modules { max-width: 1380px; margin: -28px auto 0; padding: 0 28px; display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; position: relative; }
.module-card { min-height: 172px; padding: 20px; display: flex; flex-direction: column; align-items: flex-start; text-align: left; color: var(--ink); background: white; border: 1px solid var(--line); border-radius: 15px; box-shadow: 0 12px 35px rgba(16,44,58,.07); }
.module-card:hover { color: white; background: var(--ink); border-color: var(--ink); }
.module-card > span { color: var(--gold); font: 600 18px Newsreader, serif; }
.module-card strong { margin-top: auto; font: 600 20px Newsreader, serif; }
.module-card small { margin-top: 8px; color: var(--muted); font-size: 10px; line-height: 1.5; }
.module-card:hover small { color: rgba(255,255,255,.68); }
.recent-activity { max-width: 1180px; margin: 75px auto 110px; padding: 0 28px; }
.section-title { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.section-title h2 { margin: 2px 0 0; font-size: 32px; }
.activity-list { background: white; border: 1px solid var(--line); border-radius: 15px; overflow: hidden; }
.activity-list article { display: grid; grid-template-columns: auto 1fr auto; gap: 13px; align-items: center; padding: 15px 18px; border-bottom: 1px solid var(--line); }
.activity-list article:last-child { border-bottom: 0; }
.activity-list strong { font-size: 13px; }
.activity-list p { margin: 3px 0 0; color: var(--muted); font-size: 11px; }
.activity-list time { color: var(--muted); font-size: 10px; }
.activity-icon { width: 34px; height: 34px; display: grid; place-items: center; color: var(--teal); background: var(--teal-pale); border-radius: 10px; font-weight: 700; }
.activity-icon.analysis { color: #8b651d; background: #fff5dc; }
.activity-icon.refresh { color: #2d5e91; background: #eaf2fb; }
.activity-empty { min-height: 150px; display: grid; place-items: center; align-content: center; gap: 5px; padding: 30px; color: var(--muted); text-align: center; }
.activity-empty strong { color: var(--ink); }

.evidence-toolbar { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; padding: 13px 15px; background: white; border: 1px solid var(--line); border-radius: 12px; }
.evidence-toolbar label { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 11px; font-weight: 700; }
.matrix-summary { margin-left: auto; color: var(--muted); font-size: 11px; }
.matrix-wrap { overflow-x: auto; background: white; border: 1px solid var(--line); border-radius: 15px; }
.evidence-table { width: 100%; border-collapse: collapse; min-width: 960px; }
.evidence-table th { padding: 12px 14px; color: var(--muted); background: #f3f6f4; border-bottom: 1px solid var(--line); text-align: left; font-size: 10px; text-transform: uppercase; letter-spacing: .08em; }
.evidence-table td { padding: 15px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; font-size: 12px; }
.evidence-table tr:last-child td { border-bottom: 0; }
.evidence-table td:nth-child(2) { max-width: 520px; }
.evidence-table td > strong { display: block; font: 600 16px/1.25 Newsreader, serif; }
.evidence-table small { display: block; margin-top: 4px; color: var(--muted); font-size: 9px; }
.evidence-table a { color: var(--teal); font-weight: 700; text-decoration: none; }
.evidence-table input { width: 17px; height: 17px; accent-color: var(--teal); }
.design-pill { display: inline-block; padding: 5px 8px; background: #edf1ef; border-radius: 20px; font-size: 9px; font-weight: 700; }
.design-pill.randomized { color: #075f59; background: #dff2ec; }
.design-pill.observational { color: #3a5d88; background: #e7eff9; }
.design-pill.review { color: #815f21; background: #fff2d6; }
.reporting-bar { width: 100px; height: 7px; overflow: hidden; background: #e9eeec; border-radius: 10px; }
.reporting-bar i { height: 100%; display: block; background: linear-gradient(90deg, var(--gold), var(--teal)); border-radius: inherit; }
.report-score-0 i { width: 0; }.report-score-1 i { width: 20%; }.report-score-2 i { width: 40%; }.report-score-3 i { width: 60%; }.report-score-4 i { width: 80%; }.report-score-5 i { width: 100%; }
.grade { width: 30px; height: 30px; display: grid; place-items: center; color: white; border-radius: 50%; font-weight: 800; }
.grade-A { background: #08736a; }.grade-B { background: #468871; }.grade-C { background: #a98035; }.grade-D { background: #a45959; }
.graph-panel { margin-top: 28px; padding: 24px; background: white; border: 1px solid var(--line); border-radius: 16px; }
.graph-legend { display: flex; gap: 7px; align-items: center; color: var(--muted); font-size: 10px; }
.graph-legend i { width: 9px; height: 9px; background: var(--teal); border-radius: 50%; }.graph-legend i:nth-child(2) { margin-left: 8px; background: var(--gold); }
.knowledge-graph { margin-top: 18px; overflow: hidden; background: radial-gradient(circle at center, #f1f7f4, #fbfcfa 63%); border: 1px solid #e4eae7; border-radius: 12px; }
.knowledge-graph svg { width: 100%; min-width: 760px; display: block; }
.graph-links line { stroke: #c6d6d1; stroke-width: 1; opacity: .65; }
.term-node circle { fill: var(--gold); opacity: .88; }.term-node text { fill: #6a552e; font: 9px "DM Sans", sans-serif; }
.article-node circle { fill: var(--teal); stroke: white; stroke-width: 3; }.article-node text { fill: var(--ink); font: 8px ui-monospace, monospace; }

.review-layout { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(300px, .65fr); gap: 20px; align-items: start; }
.protocol-card, .review-snapshot { padding: 25px; background: white; border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 12px 35px rgba(16,44,58,.05); }
.protocol-card h2, .review-snapshot h2 { margin: 0 0 20px; font-size: 28px; }
.protocol-card > label, .protocol-grid label { display: grid; gap: 7px; margin-top: 15px; color: var(--muted); font-size: 11px; font-weight: 700; }
.protocol-card input, .protocol-card textarea { width: 100%; padding: 11px 12px; resize: vertical; color: var(--ink); background: #fbfcfa; border: 1px solid var(--line); border-radius: 9px; outline: none; line-height: 1.55; }
.protocol-card input:focus, .protocol-card textarea:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(13,118,110,.08); }
.protocol-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.review-snapshot { position: sticky; top: 92px; }
.snapshot-count { padding: 19px; text-align: center; background: linear-gradient(145deg, #eaf5f1, #f5f6f0); border-radius: 12px; }
.snapshot-count strong { display: block; font: 600 48px/1 Newsreader, serif; }.snapshot-count span { color: var(--muted); font-size: 10px; }
.review-snapshot dl { margin: 18px 0; }
.review-snapshot dl div { display: flex; justify-content: space-between; gap: 15px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 11px; }
.review-snapshot dt { color: var(--muted); }.review-snapshot dd { margin: 0; font-weight: 700; text-align: right; }
.review-snapshot button { width: 100%; margin-top: 8px; }
.refresh-result:not(:empty) { margin-top: 14px; padding: 12px; display: grid; gap: 5px; color: var(--muted); background: #f4f7f5; border-radius: 9px; font-size: 10px; }
.refresh-result strong { color: var(--ink); font-size: 12px; }.refresh-result small { line-height: 1.5; }

@media (max-width: 760px) {
  .masthead { height: auto; padding: 13px 15px; align-items: flex-start; gap: 12px; }
  .brand span:last-child { display: none; }
  nav { overflow-x: auto; }
  .nav-link { padding: 8px; white-space: nowrap; font-size: 12px; }
  .hero { padding: 60px 18px 35px; }
  .search-box { grid-template-columns: 20px 1fr; }
  .search-box button { grid-column: 1 / -1; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .heading-actions { width: 100%; flex-wrap: wrap; }
  .builder-layout { grid-template-columns: 1fr; }
  .section-nav { flex-direction: row; overflow-x: auto; padding-bottom: 5px; }
  .section-nav button { white-space: nowrap; }
  .about-grid { grid-template-columns: 1fr; }
  .library-card { grid-template-columns: 1fr; }
  .icon-button { justify-self: start; }
  #dialog-content { padding: 30px 22px; }
  .provider-settings, .dual-report { grid-template-columns: 1fr; }
  .settings-content { padding: 34px 20px; }
  .ai-reader-head { flex-direction: column; }
  .ai-task-grid { grid-template-columns: 1fr 1fr; }
  .ai-question-row { grid-template-columns: 1fr; }
  .citation-writer-head { flex-direction: column; }
  .citation-writer-grid { grid-template-columns: 1fr; }
  .os-hero { min-height: 0; padding: 60px 20px 75px; grid-template-columns: 1fr; gap: 34px; }
  .os-hero h1 { font-size: clamp(48px, 15vw, 70px); }
  .os-modules { margin-top: -35px; grid-template-columns: 1fr 1fr; padding: 0 16px; }
  .module-card { min-height: 145px; }
  .recent-activity { margin-top: 55px; padding: 0 16px; }
  .activity-list article { grid-template-columns: auto 1fr; }
  .activity-list time { grid-column: 2; }
  .review-layout { grid-template-columns: 1fr; }
  .review-snapshot { position: static; }
  .protocol-grid { grid-template-columns: 1fr; }
  .graph-panel { padding: 16px; overflow-x: auto; }
}

@media (min-width: 761px) and (max-width: 1120px) {
  .masthead { padding-inline: 20px; }
  .brand span:last-child { display: none; }
  .nav-link { padding-inline: 8px; font-size: 12px; }
  .provider-settings { grid-template-columns: repeat(2, 1fr); }
  .ncbi-settings { grid-column: 1 / -1; }
  .os-modules { grid-template-columns: repeat(3, 1fr); }
}
