:root { color-scheme: light; --bg: #f6f8fb; --panel: #fff; --soft: #f0f4fa; --line: #e0e6ef; --text: #273142; --muted: #647184; --accent: #3469e8; --teal: #0f766e; --danger: #b42318; --warn: #854d0e; --shadow: 0 2px 12px #27314208; font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-size: 14px; }
[hidden] { display: none !important; }
a { color: var(--accent); text-underline-offset: 3px; }
button, input, textarea, select { font: inherit; }
button, .button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px; border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; background: var(--panel); color: var(--text); cursor: pointer; text-decoration: none; font-weight: 600; }
button:hover, .button:hover { border-color: var(--accent); color: var(--accent); }
button:disabled { cursor: not-allowed; opacity: .5; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.secondary { background: var(--soft); }
.danger { color: var(--danger); }
.icon-button { font-size: 20px; padding: 4px 10px; min-width: 38px; }
input, select, textarea { width: 100%; min-height: 40px; border: 1px solid #cdd6e3; border-radius: 7px; padding: 9px 10px; background: var(--panel); color: var(--text); }
textarea { resize: vertical; line-height: 1.5; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
fieldset > input, fieldset > textarea { margin-bottom: 14px; }
input[type="checkbox"] { width: 17px; height: 17px; min-height: auto; margin: 3px 0; accent-color: var(--accent); flex-shrink: 0; }
input[type="range"] { padding: 0; }
label { display: block; font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 6px; }
form > input, form > textarea, form > select { margin-bottom: 14px; }
:focus-visible { outline: 3px solid #90b4ff; outline-offset: 3px; }
h1, h2, h3, h4, p { margin-top: 0; }
h1 { font-size: 22px; margin-bottom: 0; }
h2 { font-size: 25px; letter-spacing: -.5px; margin-bottom: 9px; }
h3 { font-size: 16px; margin-bottom: 10px; }
h4 { font-size: 14px; margin-bottom: 7px; }
p { line-height: 1.55; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.eyebrow { display: block; color: var(--teal); font-size: 11px; font-weight: 800; letter-spacing: .8px; text-transform: uppercase; margin-bottom: 8px; }
.skip-link { position: fixed; top: -70px; left: 12px; z-index: 10; padding: 12px; background: var(--panel); }
.skip-link:focus { top: 10px; }
.app-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 76px; background: var(--panel); border-bottom: 1px solid var(--line); padding: 15px 26px; }
.brand { display: flex; gap: 11px; align-items: center; color: var(--text); text-decoration: none; font-size: 14px; font-weight: 750; }
.brand-mark { width: 36px; height: 36px; border-radius: 11px; background: #eaf0ff; color: var(--accent); display: grid; place-items: center; font-size: 13px; }
.brand small { display: block; font-weight: 400; color: var(--muted); margin-top: 3px; font-size: 11px; }
.workspace { display: grid; grid-template-columns: 274px minmax(0, 1fr); min-height: calc(100vh - 76px); }
.sidebar { background: var(--panel); border-right: 1px solid var(--line); padding: 23px 18px; }
.sidebar-heading, .dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.sidebar-heading { align-items: center; margin-bottom: 12px; }
.project-list { display: grid; gap: 6px; margin: 16px 0 22px; max-height: 360px; overflow-y: auto; }
.project-choice { display: block; text-align: left; width: 100%; padding: 12px; border-color: transparent; font-weight: 400; }
.project-choice strong { display: block; overflow-wrap: anywhere; }
.project-choice small { display: block; font-size: 11px; margin-top: 5px; color: var(--muted); line-height: 1.4; }
.project-choice[aria-current="true"] { background: #edf3ff; border-color: #c5d6ff; color: var(--accent); }
.create-box { border-top: 1px solid var(--line); padding-top: 17px; }
summary { cursor: pointer; font-weight: 700; padding: 4px 0; }
.create-box form { margin-top: 18px; }
.create-box button { width: 100%; }
.sidebar-footnote { margin-top: 24px; }
main { min-width: 0; padding: 22px 28px 50px; }
.notice { border: 1px solid var(--line); border-radius: 8px; background: var(--panel); padding: 11px 14px; margin-bottom: 18px; line-height: 1.5; font-size: 13px; overflow-wrap: anywhere; }
.notice.success { color: #166534; background: #f0fdf4; border-color: #bbf7d0; }
.notice.error { color: var(--danger); background: #fff4f2; border-color: #fecdca; }
.notice.busy { color: var(--accent); background: #eff6ff; }
.conflict-banner { padding: 15px; background: #fffbeb; border: 1px solid #f5d88c; border-radius: 9px; color: var(--warn); margin-bottom: 18px; }
.conflict-banner p { margin: 7px 0 12px; }
.empty-state { max-width: 640px; text-align: center; margin: 70px auto; color: var(--muted); padding: 28px; }
.empty-state h2 { color: var(--text); }
.empty-symbol { display: block; color: #9ab1d8; font-size: 50px; margin-bottom: 20px; }
.project-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; padding: 10px 0 23px; }
.project-header h2 { overflow-wrap: anywhere; }
.project-header p { max-width: 800px; color: var(--muted); white-space: pre-wrap; overflow-wrap: anywhere; margin-bottom: 14px; }
.header-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; flex-shrink: 0; }
.meta-row, .chips { display: flex; flex-wrap: wrap; gap: 7px; }
.pill { display: inline-block; padding: 5px 8px; border-radius: 6px; border: 1px solid var(--line); background: var(--panel); color: var(--muted); font-size: 11px; font-weight: 600; }
.tabs { display: flex; flex-wrap: wrap; gap: 3px; border-bottom: 1px solid var(--line); margin-bottom: 22px; }
.tabs button { border: 0; border-bottom: 3px solid transparent; border-radius: 5px 5px 0 0; background: transparent; padding: 12px 11px; font-size: 12px; }
.tabs button[aria-selected="true"] { border-bottom-color: var(--accent); color: var(--accent); background: #edf3ff; }
.section-heading { display: flex; justify-content: space-between; gap: 15px; align-items: center; margin-bottom: 18px; }
.section-heading p { margin-bottom: 0; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 20px; box-shadow: var(--shadow); min-width: 0; }
.card + .card { margin-top: 13px; }
.card-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; }
.card-title-row h3 { overflow-wrap: anywhere; }
.two-columns { display: grid; grid-template-columns: minmax(270px, .85fr) minmax(0, 1.25fr); gap: 20px; align-items: start; }
.form-help { color: var(--muted); font-size: 12px; margin-bottom: 16px; }
.form-note { color: var(--teal); background: #f0fdfa; padding: 11px; border: 1px solid #c7ebe7; border-radius: 7px; font-size: 12px; }
.stack { display: grid; gap: 13px; }
.stack .card + .card { margin-top: 0; }
.empty-list { padding: 26px 18px; border: 1px dashed #cdd6e3; border-radius: 9px; color: var(--muted); text-align: center; background: #ffffff70; line-height: 1.6; }
.source { display: flex; gap: 7px; flex-wrap: wrap; align-items: baseline; color: var(--muted); font-size: 12px; line-height: 1.5; }
.source a { font-weight: 600; overflow-wrap: anywhere; }
.source code { font-size: 10px; }
.document-list { display: grid; gap: 12px; }
.document-list .card { margin: 0; }
.document-list p { margin-bottom: 11px; }
.document-meta { display: flex; gap: 15px; flex-wrap: wrap; margin-top: 9px; color: var(--muted); font-size: 12px; }
blockquote { margin: 13px 0 8px; border-left: 3px solid #b8ccf8; padding: 9px 13px; background: #f7faff; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.6; }
.fragment { padding-top: 12px; margin-top: 12px; border-top: 1px solid var(--line); }
.code-definition, .note-content { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--muted); }
.checkbox-list { display: grid; gap: 7px; margin-bottom: 17px; max-height: 240px; overflow-y: auto; }
.check-row { display: flex; gap: 10px; align-items: flex-start; padding: 9px 10px; border: 1px solid var(--line); border-radius: 7px; font-weight: 400; color: var(--text); margin: 0; }
.check-row span { min-width: 0; overflow-wrap: anywhere; }
.check-row small { display: block; color: var(--muted); font-size: 11px; margin-top: 4px; }
.check-row:has(input:checked) { background: #f0f5ff; border-color: #bcd0ff; }
.map-card { margin-top: 20px; }
.map-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.map-surface { overflow: auto; background: #fafcff; border: 1px solid var(--line); border-radius: 8px; margin: 16px 0; }
.map-surface svg { display: block; min-width: 700px; width: 100%; }
.map-edge { stroke: #9baac2; stroke-width: 1.5; }
.map-edge.manual { stroke: #4574ce; stroke-width: 2; }
.map-edge-label { fill: #596b86; font-size: 10px; paint-order: stroke; stroke: #fafcff; stroke-width: 4px; stroke-linejoin: round; }
.map-node rect { fill: #edf3ff; stroke: #a9c2f7; }
.map-node.category rect { fill: #e8f7f3; stroke: #78bcae; }
.map-node text { font-size: 11px; fill: var(--text); }
.map-node.selected rect { stroke: var(--accent); stroke-width: 3; }
.map-node { cursor: pointer; }
.map-controls { display: grid; grid-template-columns: 1.5fr 1fr 1fr auto; gap: 12px; align-items: end; }
.map-controls label { margin: 0; }
.map-controls input, .map-controls select { margin-top: 6px; }
.relation-list { padding-left: 20px; line-height: 1.7; color: var(--muted); font-size: 12px; }
.context-block pre, .history-entry pre { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 380px; overflow: auto; background: var(--soft); padding: 14px; border-radius: 7px; font-size: 11px; line-height: 1.6; }
.context-block { margin-top: 15px; }
.context-block summary { font-size: 12px; }
.history-list { display: grid; gap: 12px; }
.history-entry { padding-left: 18px; border-left: 3px solid #c5d4ee; }
.history-entry p { margin: 5px 0; }
.history-entry small { color: var(--muted); }
.history-entry summary { font-size: 12px; }
dialog { width: min(780px, calc(100vw - 32px)); max-height: 88vh; border: 1px solid var(--line); border-radius: 13px; padding: 24px; background: var(--panel); color: var(--text); box-shadow: 0 24px 70px #142b4d30; }
dialog::backdrop { background: #172b4d66; }
.dialog-heading h2 { font-size: 22px; }
.catalog-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 12px 0; }
.catalog-toolbar > span { margin-right: auto; }
.catalog-toolbar button { font-size: 11px; min-height: 32px; }
.catalog-list { display: grid; gap: 7px; max-height: 43vh; overflow-y: auto; padding: 2px; }
.catalog-list .check-row { padding: 12px; }
.dialog-footer { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-top: 17px; margin-top: 16px; border-top: 1px solid var(--line); }
@media (max-width: 1100px) { .workspace { grid-template-columns: 240px minmax(0, 1fr); } main { padding: 20px; } .two-columns { grid-template-columns: 1fr; } .project-header { flex-direction: column; gap: 14px; } .header-actions { justify-content: flex-start; } }
@media (max-width: 700px) { .workspace { display: block; } .app-header { padding: 13px 16px; } .app-header > .button { padding: 8px; font-size: 11px; } .sidebar { border-right: 0; border-bottom: 1px solid var(--line); padding: 20px 16px; } .project-list { max-height: 180px; margin-bottom: 15px; } .sidebar-footnote { display: none; } .create-box form { display: grid; grid-template-columns: 1fr; } main { padding: 18px 14px 40px; } .project-header h2 { font-size: 24px; } .tabs { flex-wrap: nowrap; overflow-x: auto; } .tabs button { white-space: nowrap; } .section-heading, .card-title-row { flex-wrap: wrap; } .card { padding: 16px; } .map-controls { grid-template-columns: 1fr 1fr; } .map-controls label:first-child { grid-column: 1 / -1; } .map-controls button { grid-column: 1 / -1; } .empty-state { margin: 20px auto; padding: 20px 8px; } .dialog-footer { align-items: stretch; flex-direction: column; } }
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }

/* Project-scoped code cards: color is identity metadata, not a citation mutation. */
.rp-code-swatch { display:inline-block; width:14px; height:14px; border:1px solid #33415555; border-radius:4px; margin-right:7px; vertical-align:middle; flex-shrink:0; }
.rp-code-color-field { display:flex; align-items:center; gap:10px; margin:0 0 16px; }
.rp-code-color-field input[type="color"] { width:64px; min-width:64px; height:40px; padding:4px; }
.rp-code-criteria { margin:12px 0 16px; padding:12px; border:1px solid var(--line); border-radius:8px; background:#f8fafc; }
.rp-code-criteria h4 { overflow-wrap:anywhere; }
.rp-code-criteria dl { margin:0; }
.rp-code-criteria dt { font-size:12px; font-weight:700; margin-top:9px; }
.rp-code-criteria dd { margin:4px 0 0; color:var(--muted); white-space:pre-wrap; overflow-wrap:anywhere; font-size:12px; line-height:1.5; }
.rp-code-pending { color:var(--warn); background:#fffbeb; border-radius:6px; padding:8px; font-size:12px; margin:12px 0 0; }
.rp-code-id { margin:12px 0 0; overflow-wrap:anywhere; }
.rp-card-action { margin-top:14px; }
.rp-standalone { margin-top:16px; }
.rp-standalone form { margin-top:16px; }
.rp-extra-codes { margin:0 0 16px; }
.rp-extra-codes .checkbox-list { margin-top:12px; max-height:360px; }
.rp-candidate-criteria { margin:4px 8px 10px; font-size:12px; }
.rp-code-card .fragment .danger { font-size:12px; }


/* Project themes: many-to-many analytical links, independent from category maps. */
.rp-theme-actions { display:flex; flex-wrap:wrap; gap:8px; align-items:center; }
.rp-theme-editor { margin-bottom:24px; }
.rp-theme-editor > summary { font-weight:700; cursor:pointer; }
.rp-theme-editor form { margin-top:16px; }
.rp-theme-fields { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:24px; }
.rp-theme-fields > div { min-width:0; }
.rp-theme-fields fieldset { border:1px solid var(--line); border-radius:8px; padding:12px; min-width:0; }
.rp-theme-fields legend { font-size:13px; font-weight:700; padding:0 5px; }
.rp-theme-evidence-picker { margin:18px 0; }
.rp-theme-evidence-picker > summary { cursor:pointer; font-weight:600; }
.rp-theme-evidence-options { max-height:560px; overflow-y:auto; border:1px solid var(--line); border-radius:8px; padding:10px; }
.rp-theme-evidence { padding:12px 0; border-bottom:1px solid var(--line); min-width:0; }
.rp-theme-evidence p { overflow-wrap:anywhere; }
.rp-theme-evidence:last-child { border-bottom:0; }
.rp-theme-evidence-fields { display:grid; grid-template-columns:minmax(150px,.6fr) minmax(0,1.4fr); gap:12px; }
.rp-theme-evidence-fields label { min-width:0; }
.rp-theme-evidence-fields select, .rp-theme-evidence-fields textarea { margin-top:7px; }
.rp-theme-stale { border-left:3px solid var(--warn); padding-left:10px; }
.rp-theme-matrix-section { min-width:0; margin-top:24px; }
.rp-theme-table-scroll { max-width:100%; overflow-x:auto; border:1px solid var(--line); border-radius:9px; background:var(--panel); }
.rp-theme-table { border-collapse:collapse; width:100%; min-width:1050px; table-layout:fixed; font-size:12px; }
.rp-theme-table th, .rp-theme-table td { text-align:left; vertical-align:top; padding:15px; border-bottom:1px solid var(--line); overflow-wrap:anywhere; font-weight:400; }
.rp-theme-table thead th { background:#f0f5fb; font-weight:700; }
.rp-theme-table th:nth-child(1) { width:24%; }
.rp-theme-table th:nth-child(2) { width:23%; }
.rp-theme-table th:nth-child(3) { width:18%; }
.rp-theme-table th:nth-child(4) { width:24%; }
.rp-theme-table th:nth-child(5) { width:11%; }
.rp-theme-table h4 { margin:0 0 10px; font-size:14px; }
.rp-theme-table p { margin:10px 0; }
.rp-theme-table button { font-size:11px; }
.rp-theme-category-list { padding-left:15px; margin:0; }
.rp-theme-category-list li { margin-bottom:12px; }
.rp-theme-category-list code { display:block; font-size:10px; margin-top:4px; }
.rp-theme-id { display:block; overflow-wrap:anywhere; font-size:10px; }
.rp-theme-text { white-space:pre-wrap; overflow-wrap:anywhere; }
.rp-theme-detail-list { display:grid; gap:14px; margin-top:18px; }
.rp-theme-detail-list .card { margin:0; }
.rp-theme-detail summary { cursor:pointer; font-weight:600; overflow-wrap:anywhere; }
.rp-theme-detail h4 { margin-top:20px; }
@media(max-width:800px) { .rp-theme-fields, .rp-theme-evidence-fields { grid-template-columns:minmax(0,1fr); } .rp-theme-table { min-width:950px; } }

/* Read-only project logbook exports. */
.rp-logbook-layout { grid-template-columns: minmax(360px, 1.35fr) minmax(0, .85fr); }
.rp-logbook select { margin-bottom: 12px; }
.rp-logbook-sections { border: 1px solid var(--line); border-radius: 8px; padding: 14px; margin: 0 0 18px; }
.rp-logbook-sections legend { padding: 0 5px; font-weight: 700; }
.rp-logbook-section-toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.rp-logbook-section-toolbar button { min-height: 34px; padding: 6px 10px; font-size: 12px; }
.rp-logbook-section-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr)); gap: 9px; }
.rp-logbook-section-grid .check-row { font-size: 12px; line-height: 1.45; padding: 10px; }
.rp-logbook-section-grid .check-row small { line-height: 1.45; }
.rp-logbook-section-count { margin: 12px 0 7px; }
.rp-logbook-sections .form-help { margin-bottom: 0; }
.rp-logbook-sections .notice { margin: 12px 0 0; }
.rp-logbook-chat { margin-bottom: 10px; }
.rp-logbook-actions { display: flex; flex-wrap: wrap; gap: 9px; margin: 18px 0; }
.rp-logbook-contents { margin: 0 0 20px; padding-left: 20px; line-height: 1.8; }
.rp-logbook #logbook-status { margin-bottom: 0; }
@media (max-width: 1100px) { .rp-logbook-layout { grid-template-columns: 1fr; } }
@media (max-width: 800px) { .rp-logbook-actions button { width: 100%; } }
