/* Reusable source/object/graph interactions. Cards and type reuse style.css. */
.research-panel { min-width: 0; }
.research-scroll { overflow: auto; max-height: 38rem; padding: 0.3rem; }
.research-object { scroll-margin-block: 1rem; }
.research-object[data-selected="true"] { outline: 2px solid #86582b; outline-offset: -2px; }
.research-object .object-select { display: block; width: 100%; }
.object-select, .source-span { font: inherit; color: inherit; background: none; border: 0; text-align: left; cursor: pointer; }
.object-select { padding: 0.35rem 0; }
.source-span { display: inline; padding: 0; line-height: inherit; white-space: pre-wrap; border-bottom: 1px dotted #a98a68; }
.object-select:focus-visible, .source-span:focus-visible, .research-graph [role="button"]:focus-visible { outline: 2px solid #86582b; outline-offset: 2px; }
.source-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.research-tree { margin: 0; padding-left: 1rem; list-style: none; }
.research-tree .entry-card { margin-block: 0.5rem; }
.research-disclosure { margin-block: 1.4rem; }
.research-disclosure > summary { cursor: pointer; font-weight: 600; }
.research-panel pre, .research-disclosure pre { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 32rem; overflow: auto; }
.research-table-wrap { overflow-x: auto; }
.research-table { width: 100%; min-width: 44rem; border-collapse: collapse; font-size: 0.87rem; text-align: left; }
.research-table th, .research-table td { padding: 0.45rem; border-bottom: 1px solid #ded4c9; vertical-align: top; overflow-wrap: anywhere; }
.research-graph { display: block; width: 100%; min-width: 640px; }
.research-graph .graph-edge { stroke: #b8a48d; fill: none; stroke-width: 1.2; }
.research-graph .graph-edge[data-selected="true"] { stroke: #86582b; stroke-width: 2.5; }
.research-graph marker path { fill: #86582b; }
.research-graph [role="button"] { cursor: pointer; }
.research-graph rect { fill: #fffdf9; stroke: #ded4c9; rx: 8px; }
.research-graph [data-selected="true"] rect { fill: #f4eadc; stroke: #86582b; stroke-width: 2; }
.research-graph text { fill: #3c2f22; font-size: 16px; }
/* Compact, reusable source annotations and typed relation lanes. */
.research-source-stack .entry-card { padding: var(--source-card-padding, 0.65rem); margin-block: 0.4rem; }
.research-source-stack .entry-card-title { font-size: 0.78rem; margin-bottom: 0.15rem; }
.research-source-stack .source-text { margin: 0; line-height: 1.75; }
.source-span[data-selected="true"] { outline: 2px solid #86582b; outline-offset: 1px; }
.source-span[data-unresolved="true"] { border-bottom: 2px dotted #9b592f; }
.research-annotations { display: flex; flex-wrap: wrap; align-items: start; gap: 0.3rem; font-size: 0.8rem; line-height: 1.5; }
.research-annotations > section { flex-basis: 100%; }
.research-object.research-annotations > .research-tree { flex-basis: 100%; }
.research-object.research-annotations > .object-select { border: 0; }
.research-context { font-size: 0.85rem; margin-block: 0.5rem; }
.research-context > summary { cursor: pointer; }
.research-annotations .research-tree { display: flex; flex-wrap: wrap; gap: 0.3rem; padding-left: 0.6rem; }
.research-annotations .entry-card { padding: 0.15rem 0.4rem; margin: 0; border-radius: 5px; }
.research-annotations .object-select { padding: 0.15rem 0.25rem; }
.research-annotations > .object-select { border: 1px solid #ded4c9; border-radius: 5px; }
.research-legend { display: flex; flex-wrap: wrap; gap: 0.8rem; font-size: 0.72rem; margin-block: 0.3rem; }
.research-legend span::before { content: ''; display: inline-block; width: 0.7em; height: 0.7em; margin-right: 0.3em; border: 1px solid #948575; background: var(--object-fill, #fffdf9); }
[data-kind="parameter-input"] { --object-fill: #f5e6ca; }
[data-kind="value"] { --object-fill: #edf3f6; }
[data-kind="operation"] { --object-fill: #e0edf2; }
[data-kind="result"] { --object-fill: #e5eedf; }
[data-kind="unresolved"] { --object-fill: #faeee1; }
.research-graph [data-kind] rect { fill: var(--object-fill); }
.research-graph [data-kind="result"] rect { stroke-width: 2; }
.research-graph [data-unresolved="true"] rect { stroke: #9b592f; stroke-dasharray: 4 3; }
.research-graph [data-selected="true"] rect { stroke: #86582b; stroke-width: 3; }
.research-graph .graph-node-note { font-size: 12px; fill: #6a5742; }
.research-annotations [data-kind="unresolved"] { background: var(--object-fill); border-style: dashed; border-color: #b28a61; }
.research-relation { font-size: 0.87rem; line-height: 1.6; margin-block: 0.5rem; }
@media (max-width: 600px) {
  .research-properties { grid-template-columns: minmax(0, 1fr); }
  .research-properties dd { margin-bottom: 0.7rem; }
}

/* Shared workspace chrome and review forms, independent of the rendering host. */
.research-workspace-shell {color:#29313d; background:#fff; font:16px/1.5 system-ui,sans-serif; min-height:100vh;}
.research-workspace-shell * {box-sizing:border-box;}
.research-workspace-shell [hidden] {display:none !important;}
.research-workspace-shell h1 {font-size:2.65rem; line-height:1.25; margin:0 0 1.1rem; letter-spacing:normal; text-transform:none;}
.research-workspace-shell h2 {font-size:1.65rem; line-height:1.3; margin:0 0 1.1rem; letter-spacing:normal; text-transform:none; overflow-wrap:anywhere;}
.research-workspace-shell h3 {font-size:1.1rem; margin:1rem 0 .6rem;}
.research-workspace-shell p {margin:0 0 1.15rem; overflow-wrap:anywhere;}
.research-workspace-shell pre {font-size:.8rem; white-space:pre-wrap; overflow-wrap:anywhere; max-height:28rem; overflow:auto;}
.research-workspace-sidebar {background:#f0f2f6; padding:4.7rem 1.9rem 2rem;}
.research-app-identity {font-size:1.25rem; font-weight:650; line-height:1.4; margin-bottom:2.8rem !important;}
.research-muted {color:#78838f; font-size:.85rem; line-height:1.65;}
.research-scope {margin-bottom:1.5rem !important;}
.research-workspace-nav > p {font-size:.8rem; font-weight:600; margin-bottom:.6rem;}
.research-workspace-nav > button {display:block; width:100%; border:0; border-radius:.4rem; padding:.75rem .8rem; margin-bottom:.4rem; background:transparent; color:inherit; font:inherit; text-align:left; cursor:pointer;}
.research-workspace-nav > button[aria-current="page"] {background:rgba(112,130,160,.13);}
.research-workspace-nav > button:focus-visible,.research-button:focus-visible,.research-icon-button:focus-visible {outline:2px solid #7587a2; outline-offset:2px;}
.research-icon-button {font:1.6rem/1 system-ui,sans-serif; background:transparent; border:0; padding:.3rem; color:#78838f; cursor:pointer;}
.research-field {display:flex; flex-direction:column; gap:.45rem; min-width:0; font-size:.9rem; margin:0 0 1.3rem;}
.research-field select,.research-field input:not([type="file"]),.research-field textarea {width:100%; min-width:0; max-width:100%; border:1px solid transparent; background:#f0f2f6; color:#29313d; border-radius:.45rem; padding:.65rem .55rem; font:inherit;}
.research-field input[type="file"] {max-width:100%; font:inherit;}
.research-field textarea {min-height:4.6rem; resize:vertical;}
.research-field select:focus,.research-field input:focus,.research-field textarea:focus {outline:2px solid #7587a2; outline-offset:1px;}
/* Keep the picker and its highlight the same width as the field. Native OS
   menus otherwise size/paint independently while the field is resized. */
@supports (appearance:base-select) {
  .research-field select,.research-field select::picker(select) {appearance:base-select;}
  .research-field select::picker(select) {inline-size:anchor-size(width); max-inline-size:calc(100vw - 2rem); max-block-size:20rem; overflow-y:auto; margin:0; padding:.25rem; border:1px solid #d6d9df; border-radius:.45rem; background:white; color:#29313d; font:inherit; box-sizing:border-box; transition:none;}
  .research-field select option {inline-size:100%; min-inline-size:0; padding:.5rem; white-space:normal; overflow-wrap:anywhere; border-radius:.2rem; background:transparent; transition:none;}
  .research-field select option:is(:checked,:hover,:focus) {background:#e6e9ee;}
}
.research-actions {display:flex; flex-wrap:wrap; gap:.6rem; align-items:center; margin-bottom:1rem;}
.research-actions > .research-field {flex:1 1 10rem; margin:0;}
.research-button {font:inherit; font-size:.85rem; color:inherit; background:white; border:1px solid #d6d9df; border-radius:.45rem; padding:.55rem .7rem; cursor:pointer; max-width:100%; overflow-wrap:anywhere;}
.research-button:hover {background:#f5f6f9; border-color:#a1aab6;}
.research-button:disabled {opacity:.5; cursor:default;}
.research-fold {border:1px solid #d6d9df; border-radius:.5rem; margin:1rem 0 1.4rem; padding:.8rem 1rem; min-width:0;}
.research-fold > summary {cursor:pointer; font-size:.85rem;}
.research-fold[open] > summary {margin-bottom:1rem;}
.research-master-detail {display:grid; grid-template-columns:minmax(0,7fr) minmax(0,3fr); gap:1.1rem; margin-top:1.5rem;}
.research-view-switch {display:flex; flex-wrap:wrap; gap:1.1rem; margin:1.25rem 0 1.8rem;}
.research-view-switch button {display:flex; gap:.45rem; align-items:center; border:0; padding:0; background:transparent; font:inherit; font-size:.85rem; color:inherit; cursor:pointer;}
.research-view-switch button::before {content:''; width:.8rem; height:.8rem; border:1px solid #cdd1d7; border-radius:50%;}
.research-view-switch button[aria-pressed="true"]::before {border:4px solid #fa525a;}
.research-check {display:flex; align-items:center; gap:.5rem; font-size:.85rem; margin:1.5rem 0;}
.research-check input,.research-options input {accent-color:#fa525a; flex-shrink:0;}
.research-options {border:0; margin:1rem 0; padding:0; min-width:0;}
.research-options legend {font-size:.85rem; margin-bottom:.6rem;}
.research-options label {display:flex; gap:.4rem; align-items:baseline; font-size:.88rem; margin:.3rem 0; overflow-wrap:anywhere;}
.research-note {background:#e8f2ff; color:#1266b2; padding:1rem; border-radius:.4rem; font-size:.9rem;}
.research-draft-status {position:sticky; top:.6rem; z-index:10; width:fit-content; max-width:100%; padding:.3rem .6rem; border-radius:.3rem; background:#f1f4f8; color:#596b80; font-size:.82rem;}
.research-record {margin:1rem 0; padding:1rem 0; border-bottom:1px solid #e2e5e9;}
.research-source-card {padding:1rem; border-radius:.4rem; background:#f0f2f6; margin-bottom:1rem; line-height:1.9; overflow-wrap:anywhere;}
.research-corpus {margin-top:2rem; line-height:2;}
.research-corpus section {padding:1rem 0; border-bottom:1px solid #e2e5e9;}
.research-anchor {white-space:pre-wrap; line-height:1.9; overflow-wrap:anywhere;}
.research-anchor mark {background:#f4e6a3;}
