#graph-map-controls {
    position: fixed; top: var(--top-bar-height, 64px); left: 0; right: 0;
    bottom: auto !important; z-index: 6; max-width: 100%; box-sizing: border-box;
    padding: 4px 8px; background: #fff; color: #17251c; border-bottom: 1px solid #cbd5d1;
    font: 12px Arial, sans-serif;
}
#graph-map-controls [hidden] { display: none !important; }
#graph-map-controls button, #graph-map-controls select, #graph-map-controls input, #graph-map-controls summary {
    min-height: 32px; border: 1px solid #cbd5d1; border-radius: 5px;
    padding: 5px 8px; background: #fff; color: #17251c; font: inherit; box-sizing: border-box;
}
#graph-map-controls button, #graph-map-controls summary { cursor: pointer; white-space: nowrap; }
#graph-map-controls button:hover, #graph-map-controls summary:hover { background: #edf6ef; }
#graph-map-controls button:disabled { opacity: .45; cursor: default; }
#graph-map-controls [aria-pressed="true"] { background: #e2f1e5; border-color: #166534; }
#graph-map-controls :focus-visible { outline: 2px solid #166534; outline-offset: 2px; }
.map-main-tools { display: flex; flex-wrap: nowrap; gap: 4px; align-items: center; width: 100%; overflow-x: auto; }
.map-main-tools > * { flex-shrink: 0; }
.map-main-tools #graph-view { max-width: 155px; }
.map-main-tools summary { list-style: none; }
.map-main-tools summary::after { content: " +"; }
.map-main-tools details[open] summary::after { content: " -"; }
.map-menu-panel {
    position: fixed; right: 10px; width: min(420px, calc(100vw - 20px)); max-height: 65vh;
    overflow: auto; box-sizing: border-box; padding: 10px; background: #fff;
    border: 1px solid #a9bfb0; border-radius: 6px; box-shadow: 0 5px 22px #0002; z-index: 9;
}
.map-menu-panel > * { display: block; max-width: 100%; margin: 4px 0; }
.map-menu-panel select, .map-menu-panel input { width: 100%; }
.map-menu-panel input[type="checkbox"] { width: auto; }
.map-menu-panel datalist { display: none; }
.map-context-tools {
    position: fixed; bottom: 0; left: 0; right: 0; width: 100%; max-width: 100%;
    height: 48px; box-sizing: border-box; z-index: 7;
    display: flex; flex-wrap: nowrap; gap: 4px; align-items: center; overflow-x: auto;
    padding: 6px; background: #fff; border: 1px solid #a9bfb0; border-radius: 6px; box-shadow: 0 2px 10px #0001;
}
.map-context-tools > * { flex-shrink: 0; }
[data-selection-count] { padding: 0 6px; }
#map-feedback { position: fixed; bottom: 42px; right: 12px; max-width: 420px; background: #fff; font-size: 12px; }
#map-feedback:empty { display: none; }
body:has(#toolbar) #graph-map-controls { position: static; padding: 0; border: 0; }
body:has(#toolbar) #toolbar { height: 48px; flex-wrap: nowrap; overflow: visible; padding: 4px 8px; }
body:has(#toolbar) #cy { top: 48px; height: calc(100vh - 238px); }
body.gator-map:has(#toolbar) #cy { height: calc(100vh - 84px); }
body.gator-map:has(#toolbar):has(#evidence-panel:not(.collapsed)) #cy { height: calc(100vh - 238px); }
body:has(#toolbar) #detail-drawer { top: 54px; }
body {
    --map-context-height: 0px;
    --map-evidence-height: 36px;
    --map-canvas-bg: #f7faf8;
    --map-control-bg: #fff;
    --map-text-color: #17251c;
}
body:has(.map-context-tools:not([hidden])) { --map-context-height: 48px; }
body:has(#evidence-panel:not(.collapsed)) { --map-evidence-height: 190px; }
body.dark-mode { --map-canvas-bg: #17221c; --map-control-bg: #233029; --map-text-color: #f0f5f2; }
#cy { background: var(--map-canvas-bg); }
#graph-map-controls, .map-context-tools, .map-menu-panel, #map-feedback {
    background: var(--map-control-bg) !important; color: var(--map-text-color) !important;
}
#graph-map-controls button, #graph-map-controls select, #graph-map-controls input, #graph-map-controls summary {
    background: var(--map-control-bg); color: var(--map-text-color);
}
body.dark-mode #graph-map-controls button:hover, body.dark-mode #graph-map-controls summary:hover {
    background: #31483a;
}
#networkStatus { background: var(--map-control-bg); color: var(--map-text-color); }
body.dark-mode #toolbar, body.dark-mode #evidence-panel, body.dark-mode #detail-drawer {
    background: var(--map-control-bg); color: var(--map-text-color);
}
body:has(#toolbar) #cy {
    bottom: calc(var(--map-evidence-height) + var(--map-context-height));
    height: auto !important;
}
body:has(#toolbar) #evidence-panel { bottom: var(--map-context-height); }
body:has(#toolbar) #detail-drawer { bottom: calc(var(--map-evidence-height) + var(--map-context-height)); }
body:has(#toolbar) #networkStatus { bottom: calc(var(--map-evidence-height) + var(--map-context-height) + 4px); }
body.homepage-research-active #top-bar { padding: 6px; }
body.homepage-research-active #top-bar img { height: 52px; }
body:has(#workspace-save-map) #influence-layout {
    top: calc(var(--top-bar-height, 64px) + 42px); bottom: var(--map-context-height);
}
body:has(#workspace-save-map) #graph-wrap #cy {
    position: relative; inset: auto; height: auto !important; min-height: 0; flex: 1;
}
body:has(#workspace-save-map) #networkStatus { color: var(--map-text-color); background: var(--map-control-bg); }
#drawer-center-btn { margin-top: 8px; padding: 10px; width: 100%; }
