        body { margin: 0; background: #111; font-family: system-ui, sans-serif; overflow: hidden; }
        canvas { display: block; }
        #controls {
            position: fixed; top: 20px; left: 20px;
            background: rgba(20,20,20,0.95); padding: 20px;
            border-radius: 12px; color: #fff; width: 280px; z-index: 10;
            max-height: calc(100vh - 40px); overflow-y: auto;
        }
        h1 { margin: 0 0 10px; font-size: 18px; color: #4fc3f7; }
        .explain { font-size: 12px; color: #888; margin-bottom: 15px; line-height: 1.4; }
        .stat { font-size: 13px; color: #aaa; margin: 5px 0; }
        .stat b { color: #fff; }
        input[type=text] {
            width: 100%; padding: 10px; margin: 10px 0;
            background: #222; border: 1px solid #444; border-radius: 6px; color: #fff;
            box-sizing: border-box;
        }
        #results { max-height: 200px; overflow-y: auto; }
        .result { padding: 8px; cursor: pointer; font-size: 13px; color: #ccc; border-radius: 4px; border-bottom: 1px solid #333; }
        .result:hover { background: #333; }
        .result small { color: #666; }

        /* Semantic search — mode buttons + per-type result rows */
        .ds-mode { flex: 1; padding: 4px 6px; font-size: 10px;
            background: #1a1a1a; color: #888;
            border: 1px solid #333; border-radius: 4px;
            cursor: pointer; text-transform: uppercase; letter-spacing: 0.4px; }
        .ds-mode:hover { color: #ccc; border-color: #555; }
        .ds-mode.active { background: #4fc3f7; color: #000; border-color: #4fc3f7; }

        .ds-row { padding: 7px 8px; border-bottom: 1px solid #2a2a2a;
            display: block; color: #ccc; text-decoration: none; font-size: 12px;
            line-height: 1.4; cursor: pointer; }
        .ds-row:hover { background: #2a2a2a; color: #fff; }
        .ds-row:last-child { border-bottom: 0; }
        .ds-row .ds-summary, .ds-row .ds-bio, .ds-row .ds-nature { color: #ddd; }
        .ds-row .ds-title { color: #4fc3f7; font-weight: 600; font-size: 11px; }
        .ds-row .ds-meta { color: #888; font-size: 10px; margin-top: 3px; }
        .ds-row .ds-score { color: #4fc3f7; font-variant-numeric: tabular-nums; }
        .ds-row .ds-pair-arrow { color: #4fc3f7; }
        label { display: block; margin-top: 12px; font-size: 12px; color: #666; }
        input[type=range] { width: 100%; margin: 8px 0; }

        #info {
            position: fixed; bottom: 20px; left: 20px;
            background: rgba(20,20,20,0.95); padding: 15px;
            border-radius: 10px; color: #fff; display: none; z-index: 10;
            max-width: 320px; max-height: 350px; overflow-y: auto;
        }
        #info h3 { margin: 0 0 8px; color: #4fc3f7; font-size: 15px; word-break: break-all; }
        #info.locked { border: 2px solid #4fc3f7; }

        #loading {
            position: fixed; top: 50%; left: 50%; transform: translate(-50%,-50%);
            color: #4fc3f7; font-size: 18px; text-align: center;
        }

        #date-filter-wrap { margin: 15px 0 0; padding-top: 10px; border-top: 1px solid #333; }
        #date-filter-wrap label.toggle { display: flex; align-items: center; cursor: pointer;
            font-size: 12px; color: #ccc; margin-top: 0; }
        #date-filter-wrap label.toggle input { margin-right: 8px; }
        #date-filter-box { display: none; flex-direction: column; gap: 6px; margin-top: 8px;
            padding: 10px; background: rgba(255,255,255,0.04); border-radius: 6px; }
        #date-filter-box.show { display: flex; }
        #date-filter-box .dfb-row { display: flex; align-items: center; gap: 6px;
            font-size: 12px; color: #aaa; }
        #date-filter-box input[type=number] { width: 70px; padding: 4px 6px;
            background: #222; border: 1px solid #444; border-radius: 4px; color: #fff;
            box-sizing: border-box; }
        #date-filter-box .dfb-warn { font-size: 11px; color: #fbbf24; line-height: 1.3; }

        /* LLM dossier panels (per-node profile + per-edge correspondence summary).
           Ports the .ed-* pattern from networkviewer/index.html. */
        #dossier-pane {
            position: fixed; top: 20px; right: 380px;
            width: 340px; max-height: calc(100vh - 40px); overflow-y: auto;
            display: none; z-index: 10;
            background: rgba(20,20,20,0.95); padding: 14px;
            border-radius: 12px; color: #fff;
            box-shadow: 0 4px 20px rgba(0,0,0,0.4);
        }
        @media (max-width: 1180px) {
            /* On narrower screens, dock under the correspondent-panel
               instead of beside it, to avoid overlapping the left controls. */
            #dossier-pane { top: auto; right: 80px; bottom: 20px; width: 280px;
                max-height: 50vh; }
        }
        .dossier { margin: 0 0 10px; padding: 10px; background: rgba(79,195,247,0.06);
            border: 1px solid rgba(79,195,247,0.2); border-radius: 6px; }
        .dossier:last-child { margin-bottom: 0; }
        .dossier.collapsed .ed-body { display: none; }
        .ed-head { display: flex; align-items: center; gap: 6px; cursor: pointer;
            font-size: 11px; color: #4fc3f7; text-transform: uppercase;
            letter-spacing: 0.5px; user-select: none; }
        .ed-head .ed-burger { font-size: 13px; line-height: 1; }
        .ed-head .ed-hint { margin-left: auto; color: #555; text-transform: none;
            letter-spacing: 0; font-size: 10px; }
        .ed-body { margin-top: 8px; font-size: 12px; line-height: 1.45; color: #ddd; }
        .ed-title { font-weight: 600; color: #fff; margin-bottom: 4px; word-break: break-all; }
        .ed-meta { color: #888; font-size: 11px; margin-bottom: 6px; }
        .ed-badge { display: inline-block; padding: 1px 6px; border-radius: 10px;
            font-size: 10px; font-weight: 600; margin-left: 6px; text-transform: uppercase;
            letter-spacing: 0.5px; }
        .ed-badge.strong       { background: #1b5e20; color: #a5d6a7; }
        .ed-badge.incidental   { background: #424242; color: #bbb; }
        .ed-badge.same_entity  { background: #4527a0; color: #b39ddb; }
        .ed-badge.unclear      { background: #4e342e; color: #d7ccc8; }
        .ed-badge.role         { background: #0d47a1; color: #90caf9; }
        .ed-badge.kind-org     { background: #4a148c; color: #ce93d8; }
        .ed-badge.kind-person  { background: #0d47a1; color: #90caf9; }
        .ed-badge.kind-unclear { background: #4e342e; color: #d7ccc8; }
        .ed-nature, .ed-bio { color: #eee; margin: 4px 0; }
        .ed-why { color: #aaa; font-style: italic; font-size: 11px; }
        .ed-empty { color: #777; font-style: italic; font-size: 11px; }
        .ed-sec { margin-top: 8px; color: #888; font-size: 10px;
            text-transform: uppercase; letter-spacing: 0.5px; }
        .ed-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
        .ed-chip { padding: 2px 7px; border-radius: 10px; background: rgba(255,255,255,0.07);
            color: #ccc; font-size: 11px; cursor: pointer; border: 1px solid rgba(255,255,255,0.1); }
        .ed-chip:hover { background: rgba(255,255,255,0.15); color: #fff; }
        .ed-chip.term { background: rgba(245,158,11,0.10); color: #fcd34d;
            border-color: rgba(245,158,11,0.25); }
        .ed-chip.term:hover { background: rgba(245,158,11,0.20); color: #fbbf24; }
        /* Static chips: informational only — no pointer, no hover lift. */
        .ed-chip.static { cursor: default; }
        .ed-chip.static:hover { background: rgba(255,255,255,0.07); color: #ccc; }
        .ed-chip.static.term { /* same look as a regular term chip */ }
        .ed-chip.static.term:hover { background: rgba(245,158,11,0.10); color: #fcd34d; }
        .ed-spark { display: flex; align-items: flex-end; gap: 1px; height: 28px;
            margin: 6px 0 0; }
        .ed-spark .bar { flex: 1 1 0; min-width: 2px; max-width: 12px;
            background: #4fc3f7; border-radius: 1px 1px 0 0; min-height: 1px; }
        .ed-spark .bar.und { background: #555; flex-grow: 0; flex-basis: 6px; margin-left: 4px; }
        .ed-spark-labels { display: flex; justify-content: space-between;
            font-size: 9px; color: #777; margin-top: 2px; }

        .legend { margin-top: 15px; padding-top: 15px; border-top: 1px solid #333; }
        .legend-title { font-size: 11px; color: #666; margin-bottom: 8px; }
        .legend-item { display: flex; align-items: center; margin: 4px 0; font-size: 11px; color: #aaa; }
        .legend-dot { width: 10px; height: 10px; border-radius: 50%; margin-right: 8px; }

        .btn {
            display: block; margin-top: 8px; padding: 10px 14px;
            background: #4fc3f7; color: #000; border: none; border-radius: 6px;
            cursor: pointer; font-weight: 600; width: 100%; font-size: 12px;
            touch-action: manipulation;
            -webkit-tap-highlight-color: rgba(255,255,255,0.2);
        }
        .btn:hover { background: #81d4fa; }
        .btn:active { opacity: 0.8; }

        #clear-btn { display: none; background: #666; color: #fff; }
        #clear-btn:hover { background: #888; }
        #toxicdocs-btn { background: #ff9800; }
        #toxicdocs-btn:hover { background: #ffb74d; }
        #toxicdocs-pair-btn { display: none; background: #ff9800; }
        #toxicdocs-pair-btn:hover { background: #ffb74d; }
        #download-correspondence-btn { display: none; background: #ff9800; }
        #download-correspondence-btn:hover { background: #ffb74d; }

        #zip-toast {
            position: fixed; top: 20px; right: 20px;
            background: rgba(20,20,20,0.97); border: 1px solid #ff9800;
            border-radius: 10px; padding: 14px 18px; z-index: 100;
            color: #fff; font-size: 13px; max-width: 340px;
            display: none; box-shadow: 0 4px 20px rgba(0,0,0,0.5);
        }
        #zip-toast.done { border-color: #4caf50; }
        #zip-toast.error { border-color: #f44336; }
        #zip-toast-title {
            font-weight: 700; margin-bottom: 6px; font-size: 12px;
            color: #ff9800; text-transform: uppercase; letter-spacing: 0.5px;
        }
        #zip-toast.done #zip-toast-title { color: #4caf50; }
        #zip-toast.error #zip-toast-title { color: #f44336; }
        #zip-toast-msg { color: #ccc; line-height: 1.4; }
        #zip-toast-msg a { color: #4fc3f7; text-decoration: none; font-weight: 600; }
        #zip-toast-msg a:hover { text-decoration: underline; }
        #zip-toast-close {
            position: absolute; top: 8px; right: 10px;
            background: none; border: none; color: #666; cursor: pointer;
            font-size: 16px; line-height: 1;
        }
        #zip-toast-close:hover { color: #fff; }
        @keyframes zip-pulse {
            0%, 100% { opacity: 1; }
            50% { opacity: 0.5; }
        }
        #zip-toast-spinner {
            display: inline-block; animation: zip-pulse 1.5s ease-in-out infinite;
            margin-right: 6px;
        }
        #list-connections-btn { background: #00897b; color: #fff; }
        #list-connections-btn:hover { background: #26a69a; }

        #connections-list { margin-top: 10px; max-height: 150px; overflow-y: auto; }
        .conn-item { padding: 4px 0; font-size: 11px; color: #ccc; border-bottom: 1px solid #333; cursor: pointer; }
        .conn-item:hover { color: #4fc3f7; }

        #zoom-controls {
            position: fixed; bottom: 20px; right: 20px;
            background: rgba(20,20,20,0.95); padding: 10px;
            border-radius: 10px; z-index: 10;
        }
        #zoom-controls button {
            width: 36px; height: 36px; margin: 2px;
            background: #333; border: 1px solid #555; border-radius: 6px;
            color: #fff; font-size: 18px; cursor: pointer;
        }
        #zoom-controls button:hover { background: #4fc3f7; color: #000; }

        #isolate-toggle { position: fixed; bottom: 85px; right: 20px; z-index: 10; }
        #isolate-btn {
            padding: 10px 16px;
            background: #333; color: #aaa; border: 1px solid #555; border-radius: 8px;
            cursor: pointer; font-weight: 600; font-size: 12px;
        }
        #isolate-btn:hover { background: #444; color: #fff; }
        #isolate-btn.active { background: #9c27b0; color: #fff; border-color: #9c27b0; }

        .domain-badge {
            display: inline-block; background: #444; color: #ccc;
            padding: 2px 6px; border-radius: 4px; font-size: 10px; margin-left: 4px;
        }
        .hamburger { transition: transform 0.2s; display: inline-block; }
        .hamburger.open { transform: rotate(90deg); }
        .org-item {
            display: flex; justify-content: space-between; align-items: center;
            padding: 3px 0; font-size: 11px; border-bottom: 1px solid #333;
        }
        .org-item:last-child { border-bottom: none; }
        .org-name { color: #ccc; flex: 1; }
        .org-count { color: #4fc3f7; font-weight: bold; margin-left: 8px; }
        .org-type {
            font-size: 9px; padding: 1px 4px; border-radius: 3px; margin-left: 6px;
        }
        .org-type.government { background: #1565c0; color: #fff; }
        .org-type.industry { background: #c62828; color: #fff; }
        .org-type.thinktank { background: #6a1b9a; color: #fff; }
        .org-type.personal { background: #555; color: #aaa; }
        .org-type.education { background: #2e7d32; color: #fff; }
        .org-type.unknown { background: #555; color: #aaa; }

        #industry-toggle {
            margin-top: 15px; padding-top: 15px; border-top: 1px solid #333;
        }
        #industry-btn {
            width: 100%; padding: 10px 14px;
            background: #333; color: #aaa; border: 1px solid #555; border-radius: 6px;
            cursor: pointer; font-weight: 600; font-size: 12px;
        }
        #industry-btn:hover, #thinktank-btn:hover { background: #444; color: #fff; }
        #industry-btn.active { background: #c62828; color: #fff; border-color: #c62828; }
        #thinktank-btn {
            width: 100%; padding: 10px 14px;
            background: #333; color: #aaa; border: 1px solid #555; border-radius: 6px;
            cursor: pointer; font-weight: 600; font-size: 12px;
        }
        #thinktank-btn.active { background: #6a1b9a; color: #fff; border-color: #6a1b9a; }

        #industry-panel, #thinktank-panel {
            position: fixed; top: 20px; right: 80px;
            background: rgba(20,20,20,0.95); padding: 15px;
            border-radius: 10px; color: #fff; display: none; z-index: 10;
            max-width: 280px; max-height: calc(100vh - 40px); overflow-y: auto;
        }
        #thinktank-panel { right: 370px; }
        #industry-panel h3 { margin: 0 0 5px; color: #c62828; font-size: 14px; }
        #thinktank-panel h3 { margin: 0 0 5px; font-size: 14px; }
        .industry-item, .thinktank-item {
            padding: 8px 10px; margin: 4px 0; background: #222;
            border-radius: 6px; font-size: 12px;
            display: flex; justify-content: space-between; align-items: center;
            border-left: 3px solid #c62828;
        }
        .thinktank-item { border-left-color: #6a1b9a; }
        .industry-item:hover, .thinktank-item:hover { background: #333; }
        .industry-item .name, .thinktank-item .name { color: #fff; cursor: pointer; flex: 1; }
        .industry-item .count, .thinktank-item .count { color: #c62828; font-weight: bold; margin: 0 8px; }
        .thinktank-item .count { color: #6a1b9a; }
        .search-btn {
            background: none; border: none; cursor: pointer; font-size: 14px;
            padding: 2px 6px; border-radius: 4px;
        }
        .search-btn:hover { background: #444; }

        #industry-people {
            margin-top: 10px; padding-top: 10px; border-top: 1px solid #333;
            display: none;
        }
        #industry-people h4 { margin: 0 0 8px; color: #4fc3f7; font-size: 12px; }
        #industry-people-list {
            max-height: 300px; overflow-y: auto;
        }
        .person-item {
            padding: 6px 4px; font-size: 11px; color: #ccc;
            border-bottom: 1px solid #333;
            display: flex; align-items: center; justify-content: space-between;
        }
        .person-item:hover { background: #333; }
        .person-item .person-name { cursor: pointer; flex: 1; }
        .person-item .person-name:hover { color: #4fc3f7; }
        .person-item small { color: #888; margin: 0 4px; }
        #thinktank-people { margin-top: 10px; padding-top: 10px; border-top: 1px solid #333; display: none; }
        #thinktank-people h4 { margin: 0 0 8px; color: #6a1b9a; font-size: 12px; }
        #thinktank-people-list { max-height: 300px; overflow-y: auto; }

        #correspondent-panel {
            position: fixed; top: 20px; right: 80px;
            background: rgba(20,20,20,0.95); padding: 20px;
            border-radius: 12px; color: #fff; width: 280px; z-index: 10;
            display: none; max-height: calc(100vh - 100px); overflow-y: auto;
        }
        #correspondent-panel h3 { margin: 0 0 15px; color: #4fc3f7; font-size: 16px; }
        #correspondent-panel h3 .clickable-name { cursor: pointer; text-decoration: underline; }
        #correspondent-panel h3 .clickable-name:hover { color: #81d4fa; }

        #reorient-panel {
            display: none; margin-top: 8px;
        }
        #reorient-btn {
            width: 100%; padding: 8px 10px;
            background: #4fc3f7; color: #000; border: none; border-radius: 6px;
            cursor: pointer; font-weight: 600; font-size: 12px;
        }
        #reorient-btn:hover { background: #81d4fa; }

        .report-mistake {
            display: inline-block; margin-left: 6px;
            width: 18px; height: 18px; line-height: 18px; text-align: center;
            background: #444; border-radius: 50%; color: #aaa;
            font-size: 11px; font-weight: 700; text-decoration: none;
            vertical-align: middle; cursor: pointer;
            position: relative;
        }
        .report-mistake:hover { background: #ff9800; color: #000; }
        .report-mistake .report-tip {
            display: none; position: absolute; bottom: 24px; left: 50%;
            transform: translateX(-50%);
            background: rgba(20,20,20,0.97); border: 1px solid #555;
            border-radius: 6px; padding: 6px 10px; white-space: nowrap;
            color: #ccc; font-size: 11px; pointer-events: none;
        }
        .report-mistake:hover .report-tip { display: block; }

        @media (max-width: 760px) {
            #controls {
                top: auto; left: 10px; right: 10px; bottom: 10px;
                width: auto; padding: 14px; max-height: 48vh;
                border-radius: 10px;
            }
            #controls h1 { font-size: 16px; }
            #docsearch-results { max-height: 180px !important; }
            #results { max-height: 120px; }
            #domain-dropdown { max-height: 180px !important; }

            #info {
                left: 10px; right: 10px; bottom: calc(48vh + 20px);
                max-width: none; max-height: 28vh; padding: 12px;
            }
            #industry-panel,
            #thinktank-panel,
            #correspondent-panel,
            #dossier-pane {
                left: 10px; right: 10px; width: auto;
                max-width: none; max-height: 38vh;
            }
            #industry-panel,
            #thinktank-panel,
            #correspondent-panel {
                top: 10px;
            }
            #dossier-pane {
                top: auto; bottom: calc(48vh + 20px);
            }
            #zoom-controls { top: 10px; right: 10px; bottom: auto; }
            #isolate-toggle { top: 62px; right: 10px; bottom: auto; }
            #zip-toast {
                top: 10px; left: 10px; right: 10px;
                max-width: none;
            }
        }
