body.graph-workspace { --map-context-height: 0px !important; --map-evidence-height: 0px !important; }
body.graph-workspace #top-bar {
    min-height: 56px; box-sizing: border-box; padding: 4px 12px; gap: 8px;
    display: flex; align-items: center; flex-wrap: nowrap; overflow: hidden; background: #0a1628; color: #fff;
    border-bottom: 1px solid #1f2937; box-shadow: none; z-index: 30;
}
body.graph-workspace #top-bar > a { flex: 0 0 auto; display: flex; align-items: center; }
body.graph-workspace #top-bar img,
body.graph-workspace #top-bar > a img {
    height: 48px !important; width: 280px !important; min-width: 0; max-width: 280px;
    object-fit: contain; object-position: left center; margin-right: 10px;
}
body.graph-workspace #top-bar form,
body.graph-workspace #search-form {
    display: flex; flex: 0 0 auto; max-width: none; align-items: center; gap: 6px; min-width: 0; order: 1;
}
body.graph-workspace #top-bar input[name="q"],
body.graph-workspace #search-form input[name="q"],
body.graph-workspace #top-bar input[type="search"] {
    width: 42ch; min-width: 36ch; max-width: 48ch; flex: 0 0 auto;
}
/* Both the server header and the network header use this presentation. The
   candidate template's legacy form rules must not create a second design. */
body.graph-workspace #top-bar form input[name="q"],
body.graph-workspace #top-bar form button[type="submit"] {
    box-sizing: border-box; height: 32px; padding: 4px 8px;
    border: 1px solid #98ada0; border-radius: 3px;
    background: #fff; color: #111; font: 14px Arial, sans-serif;
}
body.graph-workspace #top-bar input[type="checkbox"] { flex: 0; width: 20px; min-width: 20px; height: 20px; min-height: 20px; }
body.graph-workspace #top-bar label { position: static; display: inline-flex; align-items: center; color: inherit !important; white-space: nowrap; min-height: 32px; }
body.graph-workspace #top-bar label[for="candidate_name"] { position: absolute; width: 1px; height: 1px; min-height: 0; padding: 0; overflow: hidden; clip-path: inset(50%); }
body.graph-workspace #top-bar select { max-width: 140px; }
body.graph-workspace #graph-view,
body.graph-workspace #graph-view-wrap { display: none !important; }
body.graph-workspace #theme-toggle { display: flex; align-items: center; gap: 6px; color: inherit !important; flex: 0 0 auto; }
body.graph-workspace #top-bar a { color: inherit; }
body.graph-workspace #record-tabs {
    display: flex; align-items: center; gap: 4px; margin-left: 8px; flex: 1 1 auto; order: 2; min-width: 0; overflow-x: auto;
}
body.graph-workspace #theme-toggle,
body.graph-workspace #graph-theme-button,
body.graph-workspace a.public-research-link { order: 3; }
body.graph-workspace #record-tabs .header-node-types {
    display: flex; align-items: center; gap: 8px; margin-right: 8px; color: #fff;
}
body.graph-workspace #record-tabs .header-node-types strong { font-size: 12px; font-weight: 600; }
body.graph-workspace #record-tabs .header-node-types label {
    display: inline-flex; align-items: center; gap: 4px; color: #fff; font-size: 12px; white-space: nowrap;
}
body.graph-workspace #record-tabs button {
    background: #1e3a8a; color: #fff; border: 0; padding: 6px 10px; border-radius: 6px;
    font-size: 12px; min-height: 32px; cursor: pointer; white-space: nowrap;
}
body.graph-workspace #record-tabs button.active { background: #166534; }
body.graph-workspace button, body.graph-workspace select, body.graph-workspace input,
body.graph-workspace summary { font: inherit; }
body.graph-workspace #filter-panel { width: 0; min-width: 0; padding: 0; border: 0; overflow: hidden; }
body.graph-workspace #filter-panel-body { display: block; }
body.graph-workspace #filter-panel-toggle { display: none; }
body.graph-workspace #toolbar { display: none !important; }
body.graph-workspace #graph-map-controls {
    display: flex !important; align-items: center; flex-wrap:wrap; gap:4px 12px;
    overflow: visible; height:auto !important; min-height:40px;
}
body.graph-workspace #evidence-panel [data-tab-content] { overflow-wrap: break-word; padding: 12px; font: 14px/1.5 Arial, sans-serif; }
body.graph-workspace .research-records { display: flex; flex-direction: column; gap: 8px; }
body.graph-workspace .research-record {
    border-top: 1px solid #d5ddd8; padding: 8px 0; overflow-wrap: break-word;
}
body.graph-workspace .research-record p { margin: 0 0 4px; }

body.graph-workspace #influence-layout {
    display: flex; top: calc(var(--top-bar-height, 56px) + var(--graph-toolbar-height)); bottom: 0; z-index: 1;
}
body.graph-workspace:has(#workspace-save-map) #influence-layout {
    top: calc(var(--top-bar-height, 56px) + var(--graph-toolbar-height)); bottom: 0;
}
body.graph-workspace #graph-wrap { min-width: 0; min-height: 0; flex: 1; width: 100%; }
body.graph-workspace #graph-wrap #cy { position: relative; inset: auto; height: auto !important; min-height: 0; flex: 1; }
body.graph-workspace:has(#toolbar) #cy {
    top: calc(var(--top-bar-height, 56px) + var(--graph-toolbar-height));
    bottom: 0 !important; height: auto !important;
}
body.graph-workspace #cy { bottom: 0 !important; }
body.graph-workspace #evidence-panel,
body.graph-workspace #evidence-panel.collapsed {
    height: 0 !important; min-height: 0 !important; max-height: 0 !important;
    padding: 0 !important; border: 0 !important; overflow: hidden !important;
    flex: 0 0 0 !important; width: 100%; bottom: 0; box-sizing: border-box;
    transition: none; background: var(--map-control-bg); color: var(--map-text-color);
}
body.graph-workspace #evidence-panel:not(.collapsed) {
    position: fixed !important; top: calc(var(--top-bar-height, 56px) + var(--graph-toolbar-height, 0px)) !important;
    right: 0 !important; bottom: 0 !important; left: auto !important;
    width: min(360px, 34vw) !important; height: auto !important; max-height: none !important;
    min-height: 0 !important; z-index: 80 !important; overflow: hidden !important;
    display: flex !important; flex-direction: column !important;
    padding: 0 !important; border-top: 0 !important; border-left: 1px solid #1f2937 !important;
    box-shadow: -8px 0 24px rgba(15, 23, 42, 0.12); flex: none !important;
}
body.graph-workspace #evidence-tabs, body.graph-workspace #evidence-panel > nav { display: none !important; }
body.graph-workspace #evidence-panel button { min-height: 40px; flex: 0 0 auto; padding: 4px 7px; font-size: 13px; border-radius: 3px; }
body.graph-workspace #evidence-content { flex: 1 1 auto; height: auto; min-height: 0; overflow: auto; }
body.graph-workspace #detail-drawer,
body.graph-workspace #detail-drawer.open,
body.graph-workspace #evidence-panel:not(.collapsed) #detail-drawer,
body.graph-workspace #evidence-panel:not(.collapsed) #detail-drawer.open {
    display: none !important; width: 0 !important; min-width: 0 !important; max-width: 0 !important;
    flex: 0 0 0 !important; height: 0 !important; padding: 0 !important; border: 0 !important;
    overflow: hidden !important; position: absolute !important; right: auto !important;
    top: auto !important; bottom: auto !important; background: transparent;
}
body.graph-workspace #drawer-close-btn { display: none; }

body.graph-workspace:has(#toolbar) #evidence-panel.collapsed { overflow: hidden; }
body.graph-workspace #map-coverage { margin-left: auto; }
body.graph-workspace #map-coverage summary { font-size: 12px; color: #345343; }
body.graph-workspace #networkStatus {
    position: static; inset: auto; padding: 12px; max-width: 420px; font-size: 13px;
    white-space: normal; pointer-events: auto; z-index: auto;
}
body.graph-workspace #map-coverage .map-coverage-content { max-height: 220px; overflow: auto; }
body.graph-workspace #map-coverage #networkStatus { position: static; border: 0; box-shadow: none; }
body.graph-workspace #map-coverage[data-updates] > summary::before { content: '● '; color: #16824a; }
body.graph-workspace #committee-preparation-notifications { position: static !important; width: auto !important; max-width: 100% !important; }
body.graph-workspace #map-feedback { position: static; margin: 0; font-size: 12px; white-space: normal; }
body.graph-workspace #map-feedback:not(:empty) { max-width: 360px; }
body.graph-workspace .donation-filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
body.graph-workspace .donation-filters input { width: 125px; min-height: 44px; }
body.graph-workspace .donation-filters select { min-height: 44px; }
body.graph-workspace .donation-filters select[name="committee_id"] { max-width: min(340px, 90vw); }
.donations-table-wrap { overflow-x: auto; }
.donations-table { border-collapse: collapse; min-width: 800px; width: 100%; font-size: 13px; text-align: left; }
.donations-table caption { text-align: left; padding: 6px 0; }
.donations-table th, .donations-table td { vertical-align: top; padding: 8px; border-bottom: 1px solid #ccd9d1; }
.donation-pages { display: flex; gap: 8px; margin: 12px 0; }
.coverage-note { color: #435b4d; font-size: 13px; }
body.graph-workspace #bio-strip {
    position: relative; z-index: 23; background: #1a4d3c; flex-shrink: 0;
    display: flex !important; align-items: center; gap: 12px; padding: 8px 16px;
    min-height: 72px; height: auto; color: #e5e7eb; border-bottom: 1px solid #1f2937; flex-wrap: wrap;
}
body.graph-workspace #bio-strip:not(.has-image) .bio-image { display: none !important; }
body.graph-workspace #bio-strip .bio-image {
    width: 72px; height: 72px; border-radius: 8px; overflow: hidden; flex-shrink: 0;
    background: #1f2937; display: flex; align-items: center; justify-content: center;
    border: 1px solid #374151;
}
body.graph-workspace #bio-strip .bio-image img { width: 100%; height: 100%; object-fit: contain; background: #1f2937; }
body.graph-workspace #bio-strip.has-logo .bio-image,
body.graph-workspace #bio-strip.has-logo .bio-image img { background: #f8fafc; }
body.graph-workspace #bio-strip .bio-main { flex: 3; min-width: 0; }
body.graph-workspace #bio-image-credit { font-size: 12px; color: #e5e7eb; }
body.graph-workspace #bio-image-credit a { color: #e5e7eb; text-decoration: underline; }
body.graph-workspace #bio-strip .bio-name { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
body.graph-workspace #bio-strip .bio-meta {
    display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical;
    overflow: hidden; white-space: normal; font-size: 14px; color: #d1d5db; line-height: 1.5;
}
body.graph-workspace #bio-strip .bio-stats {
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
    flex: 1 1 240px; max-width: 100%; font-size: 12px; color: #cbd5e1; line-height: 1.4;
}
body.graph-workspace.records-open #cy { right: min(360px, 34vw); width: auto; }
body.graph-workspace.records-open #graph-wrap { padding-right: min(360px, 34vw); }
body.dark-mode.graph-workspace #top-bar { background: #0a1628; color: #fff; }
body.dark-mode.graph-workspace #evidence-tabs { background: #233029; color: #f0f5f2; }
body.dark-mode.graph-workspace .coverage-note, body.dark-mode.graph-workspace #map-coverage summary { color: #daeadd; }
body.graph-workspace :focus-visible { outline: 3px solid #1f7a45; outline-offset: 2px; }
@media (max-width: 679px) {
    body.graph-workspace #top-bar { gap: 4px; padding: 4px 8px; flex-wrap: wrap; }
    body.graph-workspace #top-bar img, body.graph-workspace #top-bar > a img { width: 220px !important; height: 48px !important; min-width: 0; max-width: 220px; }
    body.graph-workspace #top-bar select { max-width: 110px; }
    body.graph-workspace #top-bar form, body.graph-workspace #search-form {
        min-width: 0; max-width: 100%; flex: 1 1 100%;
    }
    body.graph-workspace #top-bar input[name="q"],
    body.graph-workspace #search-form input[name="q"],
    body.graph-workspace #top-bar input[type="search"] {
        width: 0; min-width: 0; max-width: none; flex: 1 1 auto;
    }
    body.graph-workspace #record-tabs { flex: 1 1 100%; margin-left: 0; }
    body.graph-workspace #theme-toggle,
    body.graph-workspace #graph-theme-button,
    body.graph-workspace a.public-research-link { order: 0; }
    body.graph-workspace #map-coverage summary { padding: 0 4px; }
    body.graph-workspace.records-open #cy { right: 0; bottom: min(32dvh, 280px); }
    body.graph-workspace.records-open #graph-wrap { padding-right: 0; padding-bottom: min(32dvh, 280px); }
    body.graph-workspace #evidence-panel:not(.collapsed) {
        top: auto !important; left: 0 !important; right: 0 !important; bottom: 0 !important;
        width: auto !important; height: min(32dvh, 280px) !important; max-height: min(32dvh, 280px) !important;
        border-left: 0 !important; border-top: 1px solid #1f2937 !important; box-shadow: none;
    }
    body.graph-workspace #evidence-panel:not(.collapsed) #detail-drawer.open {
        display: none !important; width: 0 !important; height: 0 !important;
    }
    body.graph-workspace .map-menu-panel { max-height: 60dvh; }
}
.public-research-link { color: inherit; font-size: 13px; white-space: nowrap; padding: 5px; }

body.graph-workspace .person-donations-drawer {
    position: fixed; top: calc(var(--top-bar-height, 56px) + var(--graph-toolbar-height, 44px));
    right: 0; bottom: 0; width: min(340px, 92vw); z-index: 90;
    display: flex; flex-direction: column; background: #fff; color: #111827;
    border-left: 1px solid #d1d5db; box-shadow: -12px 0 24px rgba(15, 23, 42, 0.18);
    transform: translateX(100%); transition: transform 0.2s ease;
}
body.graph-workspace .person-donations-drawer.open { transform: translateX(0); }
body.graph-workspace .person-donations-header {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    padding: 10px 12px; border-bottom: 1px solid #e5e7eb; flex: 0 0 auto;
}
body.graph-workspace .person-donations-header h2 { margin: 0; font-size: 16px; }
body.graph-workspace .person-donations-actions { display: flex; gap: 6px; }
body.graph-workspace .person-donations-actions button {
    min-height: 32px; padding: 4px 8px; border: 0; border-radius: 6px;
    background: #1e3a8a; color: #fff; cursor: pointer; font-size: 12px;
}
body.graph-workspace .person-donations-actions [data-donations-close] { background: #374151; }
body.graph-workspace .person-donations-lede {
    margin: 0; padding: 10px 12px 6px; font-size: 13px; line-height: 1.45; color: #1f2937;
}
body.graph-workspace .person-donations-list { overflow: auto; flex: 1; padding: 0 8px 12px; }
body.graph-workspace .fec-recipient { border-bottom: 1px solid #e5e7eb; }
body.graph-workspace .fec-recipient-summary {
    display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
    width: 100%; background: transparent; color: inherit; border: 0; padding: 10px 4px; text-align: left; cursor: pointer;
}
body.graph-workspace .fec-recipient-name { font-size: 13px; color: #111827; }
body.graph-workspace .fec-recipient-amount { font-size: 13px; font-weight: 600; white-space: nowrap; }
body.graph-workspace .fec-recipient-detail { padding: 0 4px 10px 4px; font-size: 12px; color: #4b5563; }
body.graph-workspace .fec-recipient-detail button {
    margin-top: 6px; min-height: 32px; padding: 4px 8px; border: 0; border-radius: 6px;
    background: #1e3a8a; color: #fff; cursor: pointer;
}
body.dark-mode.graph-workspace .person-donations-drawer { background: #111827; color: #e5e7eb; border-left-color: #374151; }
body.dark-mode.graph-workspace .person-donations-lede,
body.dark-mode.graph-workspace .fec-recipient-name { color: #e5e7eb; }
body.dark-mode.graph-workspace .fec-recipient-detail { color: #9ca3af; }
body.graph-workspace .fec-recipient-detail a { color: #1e40af; }
body.dark-mode.graph-workspace .fec-recipient-detail a { color: #93c5fd; }
body.dark-mode.graph-workspace .person-donations-drawer :focus-visible { outline-color: #86efac; }
.map-find-wrap {
    position: relative; display: inline-flex; align-items: center;
}
.map-find-input {
    width: 16ch; min-width: 8ch; padding: 4px 8px;
    border: 1px solid #9ca3af; background: #fff; color: #111827;
    font-size: 12px; line-height: 1.5; border-radius: 4px; cursor: text;
}
.map-find-input:focus { border-color: #166534; outline: 2px solid #166534; outline-offset: 1px; }
.map-find-input::placeholder { color: #9ca3af; font-size: 12px; }
.map-find-results {
    position: fixed; z-index: 9998;
    min-width: 220px; max-height: 300px; overflow-y: auto;
    background: #fff; border: 1px solid #d1d5db; border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15); margin-top: 4px;
}
.map-find-item {
    display: block; width: 100%; padding: 6px 12px; border: 0; background: none;
    text-align: left; cursor: pointer; color: #1f2937; font-size: 13px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.map-find-item:hover, .map-find-item:focus { background: #f3f4f6; outline: none; }
.map-find-empty {
    padding: 8px 12px; color: #6b7280; font-size: 13px; font-style: italic;
}
body.dark-mode .map-find-input:focus, body.dark-mode .map-find-input:not(:placeholder-shown) {
    background: rgba(255,255,255,0.15); border-color: #6b7280;
}
body.dark-mode .map-find-results {
    background: #1f2937; border-color: #374151;
}
body.dark-mode .map-find-item { color: #e5e7eb; }
body.dark-mode .map-find-item:hover, body.dark-mode .map-find-item:focus { background: #374151; }
body.dark-mode .map-find-empty { color: #9ca3af; }
.node-context-menu {
    position: fixed; z-index: 9999; min-width: 200px;
    background: #fff; border: 1px solid #d1d5db; border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15); padding: 4px 0;
    font-size: 13px; line-height: 1.4;
}
.node-context-menu-title {
    padding: 6px 12px; font-weight: 600; color: #374151;
    border-bottom: 1px solid #e5e7eb; margin-bottom: 2px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 280px;
}
.node-context-menu-item {
    display: block; width: 100%; padding: 6px 12px; border: 0; background: none;
    text-align: left; cursor: pointer; color: #1f2937; font-size: 13px;
}
.node-context-menu-item:hover, .node-context-menu-item:focus {
    background: #f3f4f6; outline: none;
}
.node-context-menu-item:focus-visible {
    outline: 2px solid #3b82f6; outline-offset: -2px;
}
body.dark-mode .node-context-menu {
    background: #1f2937; border-color: #374151; color: #e5e7eb;
}
body.dark-mode .node-context-menu-title { color: #d1d5db; border-bottom-color: #374151; }
body.dark-mode .node-context-menu-item { color: #e5e7eb; }
body.dark-mode .node-context-menu-item:hover, body.dark-mode .node-context-menu-item:focus {
    background: #374151;
}
@media print {
    body.printing-donations * { visibility: hidden !important; }
    body.printing-donations #person-donations-drawer,
    body.printing-donations #person-donations-drawer * { visibility: visible !important; }
    body.printing-donations #person-donations-drawer {
        position: static !important; transform: none !important; width: auto !important;
        box-shadow: none !important; border: 0 !important; height: auto !important;
    }
    body.printing-donations .fec-recipient-detail { display: block !important; }
}

/* Approved compact record toolbar: five primary disclosure buttons plus overflow. */
body.graph-workspace #record-tabs .record-tabs-overflow { flex: 0 0 auto; }
body.graph-workspace #record-tabs .record-tabs-overflow > summary {
    display: flex; align-items: center; justify-content: center; width: 30px;
    min-height: 32px; list-style: none; background: #334155; color: #fff;
    border-radius: 6px; cursor: pointer;
}
body.graph-workspace #record-tabs .record-tabs-overflow > summary::-webkit-details-marker { display: none; }
body.graph-workspace .record-tabs-overflow-panel {
    position: fixed; z-index: 1005; min-width: 156px; padding: 6px;
    background: #0a1628; border: 1px solid #64748b; border-radius: 6px;
    box-shadow: 0 6px 18px rgba(0,0,0,.25);
}
body.graph-workspace #record-tabs .record-tabs-overflow-panel button {
    display: block; width: 100%; text-align: left; margin: 0;
}
body.graph-workspace #evidence-panel .record-panel-header {
    display: flex; align-items: center; justify-content: space-between;
    flex: 0 0 auto; gap: 8px; padding: 10px 12px;
    border-bottom: 1px solid #e5e7eb; background: #fff; color: #111827;
}
body.graph-workspace #evidence-panel .record-panel-title { margin: 0; font-size: 16px; font-weight: 700; }
body.graph-workspace #evidence-panel .record-panel-actions { display: flex; gap: 6px; align-items: center; }
body.graph-workspace #evidence-panel .record-panel-actions button {
    padding: 5px 8px; min-height: 32px; border: none; background: #1e3a8a;
    color: #fff; border-radius: 5px; cursor: pointer; font-size: 12px;
}
body.graph-workspace #evidence-panel #evidence-toggle-btn { background: #374151; }
body.dark-mode.graph-workspace #evidence-panel .record-panel-header {
    color: #e5e7eb; background: #111827; border-color: #374151;
}
@media (max-width: 679px) {
    body.graph-workspace .map-find-input { width: 10ch; min-width: 7ch; }
    body.graph-workspace #evidence-panel .record-panel-header { padding: 6px 8px; }
    body.graph-workspace #evidence-panel .record-panel-actions { gap: 3px; }
    body.graph-workspace #evidence-panel .record-panel-actions button { padding: 4px 6px; }
}

/* Structured source-backed biographies retain headings and accessible tables. */
.structured-biography { line-height: 1.6; overflow-wrap: anywhere; }
.structured-biography .biography-section { margin: 1.5rem 0; }
.structured-biography .biography-section h3 { margin: 0 0 .75rem; }
.structured-biography .biography-case { padding: .75rem 0; border-top: 1px solid currentColor; }
.structured-biography .biography-headline { margin: 1rem 0 1.5rem; padding-left: 1rem; border-left: 3px solid currentColor; }
.structured-biography .biography-headline blockquote { margin: 0 0 .75rem; font-size: 1.1em; font-weight: 600; }
.structured-biography .biography-headline figcaption,
.structured-biography .biography-status,
.structured-biography .biography-revision { font-size: .875em; }
.structured-biography .biography-sources { display: flex; flex-wrap: wrap; gap: .25rem .8rem; list-style: none; padding: 0; margin: .4rem 0 1rem; font-size: .8em; }
.structured-biography .biography-sources a { color: inherit; text-decoration: underline; }
.structured-biography .biography-table-scroll { max-width: 100%; overflow-x: auto; }
.structured-biography .biography-table { width: 100%; min-width: 36rem; border-collapse: collapse; font-size: .875em; color: inherit; background: transparent; }
.structured-biography .biography-table th,
.structured-biography .biography-table td { text-align: left; vertical-align: top; padding: .6rem; border-bottom: 1px solid currentColor; }

/* A hidden special-purpose donation drawer must never overlap another panel. */
body.graph-workspace .person-donations-drawer[hidden] { display: none !important; }
@media (max-width: 679px) {
    body.graph-workspace .person-donations-drawer.open {
        top: auto; left: 0; right: 0; bottom: 0; width: 100%;
        height: min(32dvh, 280px); max-height: min(32dvh, 280px);
        transform: translateY(0);
    }
}
