.coex-page { font-size: 1rem; }
.coex-form { display: grid; grid-template-columns: minmax(250px,1.3fr) minmax(220px,1fr) auto; align-items: end; gap: 1rem; padding: 1.5rem 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.coex-form label { display: grid; gap: .45rem; font-size: 1rem; font-weight: 600; }
.coex-form input, .coex-form select { width: 100%; min-height: 44px; font: inherit; background: var(--bg); border: 1px solid var(--border-strong); border-radius: 8px; padding: .55rem .7rem; color: var(--ink); min-width: 0; }
.coex-options { display: flex; gap: 1rem; align-items: end; flex-wrap: wrap; grid-column: 1/-1; }
.coex-options input { max-width: 110px; }
.coex-context { color: var(--ink); line-height: 1.6; }
.coex-result-heading { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin: 1.5rem 0; }
.coex-result-heading h2 { margin: 0; overflow-wrap: anywhere; }
.coex-result-heading p { margin-bottom: 0; }
.coex-downloads, .coex-links { display: flex; gap: .75rem; flex-wrap: wrap; }
.coex-workspace { border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); margin-bottom: 1.5rem; }
.coex-graph-panel { min-width: 0; padding: 1rem 0; }
.coex-graph-controls { display: flex; gap: 1.5rem; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.coex-graph-controls label { display: inline-flex; align-items: center; justify-content: flex-start; gap: .65rem; width: auto; margin: 0; }
.coex-graph-controls input { width: 20px; height: 20px; min-width: 20px; min-height: 20px; flex: 0 0 20px; padding: 0; margin: 0; accent-color: #3b7366; }
.coex-detail { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1.4fr); column-gap: 2rem; padding: 1.5rem 0; min-width: 0; border-top: 1px solid var(--border); }
.coex-detail > h3:first-child, #coexCorrelations, #coexLinks { grid-column: 1; }
.coex-detail > h3:nth-of-type(2) { grid-column: 2; grid-row: 1; }
#coexPlotLabel { grid-column: 2; grid-row: 2; }
#coexProfile { grid-column: 2; grid-row: 3 / span 3; }
.coex-detail .coex-legend { grid-column: 2; }
#coexGroups { grid-column: 1; grid-row: 4 / span 3; align-self: start; }
.coex-detail h3 { font-size: 1.2rem; overflow-wrap: anywhere; }
.coex-detail p, .coex-graph-panel p { font-size: 1rem; line-height: 1.6; }
#coexGraph, #coexProfile { display: block; width: 100%; height: auto; }
#coexGraph { height: 640px; touch-action: none; cursor: grab; background: white; }
#coexGraph:active { cursor: grabbing; }
.coex-node { cursor: grab; transition: opacity 180ms ease-out; }
.coex-edge { transition: opacity 180ms ease-out, stroke-width 180ms ease-out; }
.coex-node.is-dragging { cursor: grabbing; }
.coex-node text { user-select: none; }
.coex-graph-legend { display: flex; align-items: center; flex-wrap: wrap; gap: 1.25rem; font-family: Arial, sans-serif; font-size: 1rem; }
.coex-graph-legend span { display: inline-flex; align-items: center; gap: .5rem; }
.coex-graph-legend span::before { content: ''; display: inline-block; width: 26px; border-top: 2px solid #607d72; }
.coex-graph-legend .coex-key-query::before { width: 12px; height: 12px; border: 0; border-radius: 50%; background: #881b38; }
.coex-graph-legend .coex-key-negative::before { border-top: 2px dashed #a87140; }
.coex-zoom { display: flex; gap: .35rem; }
.coex-zoom button { min-width: 44px; min-height: 44px; font: inherit; font-size: 1.125rem; color: var(--ink); border: 1px solid var(--border); border-radius: 6px; background: white; cursor: pointer; padding: .4rem .8rem; }
.coex-zoom button:hover { background: var(--surface); }
#coexMotion { min-width: 94px; color: #28574b; border-color: #8aa99e; }
#coexMotion[aria-label="Pause network motion"] { background: #eef4f1; }
.coex-zoom button:focus-visible { outline: 2px solid var(--focus, #881b38); outline-offset: 3px; }
.coex-graph-panel .coex-graph-hint { margin: .5rem 0 0; color: var(--muted); }
.coex-node:focus-visible circle { stroke: var(--focus); stroke-width: 4px; }
.coex-links a { text-decoration: underline; text-underline-offset: 3px; }
.coex-legend { display: flex; flex-wrap: wrap; gap: 1rem; }
.coex-legend span:first-child { color: var(--berry); }
.coex-legend span:last-child { color: oklch(.42 .11 235); }
.coex-table-wrap { overflow: auto; }
.coex-table { width: 100%; border-collapse: collapse; font-size: 1rem; }
.coex-table th, .coex-table td { padding: .8rem; border-bottom: 1px solid var(--border); text-align: left; }
.coex-table th { background: var(--surface); }
.coex-table button { font: inherit; color: var(--berry); border: 0; background: none; padding: .3rem 0; text-decoration: underline; cursor: pointer; }
.coex-table td:last-child a { display: inline-block; margin-right: 1rem; }
.coex-page [hidden] { display: none !important; }
@media(max-width:900px) { .coex-detail { display: block; } }
@media(max-width:640px) { #coexGraph { height: 420px; } .coex-graph-controls { gap: .8rem; } .coex-graph-legend { order: 3; width: 100%; } }
@media(max-width:640px) { .coex-form { grid-template-columns: minmax(0,1fr); } .coex-options { gap: .8rem; } .coex-options label { flex: 1 1 140px; } .coex-options input { max-width: none; } .coex-table td, .coex-table th { padding: .65rem .4rem; } }
@media(prefers-reduced-motion:reduce) { .coex-node, .coex-edge { transition: none; } }
