* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-dark: #1a1a2e;
    --bg-panel: #16213e;
    --bg-card: #0f3460;
    --bg-input: #1a2747;
    --text-primary: #e0e0e0;
    --text-secondary: #8892a4;
    --text-muted: #5a6477;
    --accent: #4fc3f7;
    --border: #2a3a5c;
    --pep-direct: #e74c3c;
    --pep-associated: #f39c12;
    --pep-former: #95a5a6;
    --company: #8e99a4;
    --edge-family: #e74c3c;
    --edge-business: #3498db;
    --edge-corporate: #2ecc71;
    --warn: #e74c3c;
}

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft JhengHei", "PingFang TC", sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    overflow: hidden;
}

#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
}

#sidebar {
    width: 320px;
    min-width: 320px;
    background: var(--bg-panel);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

#sidebar::-webkit-scrollbar {
    width: 6px;
}

#sidebar::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
}

.sidebar-header h1 {
    font-size: 18px;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: 1px;
}

.subtitle {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

.search-section {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.search-bar {
    display: flex;
    gap: 8px;
}

#search-input {
    flex: 1;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

#btn-search {
    padding: 10px 18px;
    white-space: nowrap;
    flex-shrink: 0;
}

#search-input:focus {
    border-color: var(--accent);
}

#search-input::placeholder {
    color: var(--text-muted);
}

.search-controls {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.search-controls select {
    flex: 1;
}

.filters-section {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.filters-section h3,
.stats-section h3,
.results-section h3 {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
}

.filter-group {
    margin-bottom: 10px;
}

.filter-group label {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

#sidebar select,
#changes-view select {
    width: 100%;
    padding: 8px 10px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 13px;
    outline: none;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238892a4' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}

select:focus {
    border-color: var(--accent);
}

.filter-row {
    display: flex;
    gap: 16px;
    margin-top: 10px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    accent-color: var(--accent);
}

.stats-section {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: 6px;
    padding: 10px;
    text-align: center;
}

.stat-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--accent);
}

.stat-warn .stat-value {
    color: var(--warn);
}

.stat-label {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

.results-section {
    padding: 16px 20px;
    flex: 1;
}

.results-section h3 {
    display: flex;
    align-items: center;
    gap: 8px;
}

#results-count {
    font-size: 12px;
    font-weight: 400;
    color: var(--text-muted);
}

#results-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.result-card {
    background: var(--bg-card);
    border-radius: 6px;
    padding: 10px 12px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    border: 1px solid transparent;
}

.result-card:hover {
    background: #143a6e;
    border-color: var(--accent);
}

.result-card .name {
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.result-card .name-en {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 400;
}

.result-card .meta {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 4px;
    display: flex;
    gap: 10px;
}

.pep-badge {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 600;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.pep-badge.direct_pep { background: var(--pep-direct); }
.pep-badge.associated_pep { background: var(--pep-associated); }
.pep-badge.former_pep { background: var(--pep-former); }
.pep-badge.not_pep { background: var(--text-muted); }

.category-badge {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 10px;
    color: #fff;
    margin-left: 3px;
}

.category-badge-political { background: #3498db; }
.category-badge-military { background: #6b8e23; }
.category-badge-military_industrial { background: #555; }
.category-badge-sanctioned { background: #e74c3c; }
.category-badge-embargo { background: #8b0000; }

.btn {
    padding: 8px 14px;
    border: none;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s;
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--border);
}

#graph-container {
    flex: 1;
    position: relative;
    background: var(--bg-dark);
}

#graph-canvas {
    width: 100%;
    height: 100%;
}

.empty-state {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: var(--text-muted);
    font-size: 16px;
    pointer-events: none;
}

#legend {
    position: absolute;
    bottom: 16px;
    right: 16px;
    background: rgba(22, 33, 62, 0.92);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 16px;
    z-index: 10;
}

#legend h4 {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.legend-items {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.legend-item, .legend-line {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-secondary);
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.legend-edge {
    width: 20px;
    height: 0;
    border-top: 2px solid;
    flex-shrink: 0;
}

.legend-edge.dashed {
    border-top-style: dashed;
}

#detail-panel {
    width: 380px;
    min-width: 380px;
    background: var(--bg-panel);
    border-left: 1px solid var(--border);
    overflow-y: auto;
    transition: transform 0.25s ease, opacity 0.25s ease;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

#detail-panel.hidden {
    display: none;
}

.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 20px;
    border-bottom: 1px solid var(--border);
}

.detail-header h2 {
    font-size: 18px;
    font-weight: 700;
    color: var(--accent);
}

.btn-icon {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
    padding: 0 4px;
}

.btn-icon:hover {
    color: var(--text-primary);
}

#detail-content {
    padding: 16px 20px;
}

.detail-section {
    margin-bottom: 20px;
}

#detail-content .detail-section h4 {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
}

.detail-field {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    font-size: 13px;
}

.detail-field .field-label {
    color: var(--text-muted);
}

.detail-field .field-value {
    color: var(--text-primary);
    text-align: right;
    max-width: 60%;
}

.detail-list {
    list-style: none;
}

.detail-list li {
    padding: 8px 0;
    font-size: 13px;
    border-bottom: 1px solid rgba(42, 58, 92, 0.3);
}

.detail-list li:last-child {
    border-bottom: none;
}

.li-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.category-sub {
    font-size: 11px;
    color: var(--text-secondary);
    margin: 3px 0 0 12px;
    line-height: 1.5;
    word-break: break-word;
}

.category-sources {
    font-size: 10px;
    color: var(--text-muted);
    margin: 2px 0 0 12px;
}

/* --- Category table --- */
.cat-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.cat-row td {
    padding: 5px 6px;
    border-bottom: 1px solid rgba(42, 58, 92, 0.2);
    vertical-align: top;
}

.cat-row:last-child td {
    border-bottom: none;
}

.cat-badge-cell {
    width: 90px;
    white-space: nowrap;
    border-right: 1px solid rgba(42, 58, 92, 0.2);
}

.cat-reason-cell {
    line-height: 1.5;
    word-break: break-word;
}

.cat-sub-label {
    color: var(--text-primary);
    font-weight: 500;
    font-size: 11px;
}

.cat-reason-text {
    color: var(--text-muted);
    font-size: 11px;
}

.cat-src-tag {
    display: inline-block;
    font-size: 9px;
    color: var(--text-muted);
    background: rgba(255,255,255,0.05);
    padding: 0 5px;
    border-radius: 3px;
    margin-left: 6px;
    vertical-align: middle;
}

/* --- Source section collapsible --- */
.src-header {
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 6px;
}

.src-header:hover {
    color: var(--text-primary);
}

.src-count-badge {
    font-size: 11px;
    font-weight: 600;
    background: var(--accent);
    color: #fff;
    padding: 0 7px;
    border-radius: 10px;
    line-height: 18px;
}

.src-toggle-icon {
    font-size: 10px;
    color: var(--text-muted);
    margin-left: auto;
    transition: transform 0.2s;
}

.src-detail-list:not(.hidden) ~ .src-toggle-icon,
.src-header:has(+ .src-detail-list:not(.hidden)) .src-toggle-icon {
    transform: rotate(90deg);
}

.src-detail-list {
    margin-top: 8px;
    padding: 0;
}

.src-detail-list.hidden {
    display: none;
}

.src-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 3px 8px;
    font-size: 12px;
    border-radius: 4px;
}

.src-row:nth-child(odd) {
    background: rgba(255,255,255,0.02);
}

.src-name {
    color: var(--text-secondary);
}

.src-dup-count {
    font-size: 10px;
    color: var(--text-muted);
    background: rgba(255,255,255,0.06);
    padding: 0 5px;
    border-radius: 3px;
}

.rel-info {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.kinship-badge {
    font-size: 10px;
    color: var(--text-muted);
    background: rgba(255,255,255,0.05);
    padding: 1px 6px;
    border-radius: 3px;
    white-space: nowrap;
}

.biz-header {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.biz-source {
    font-size: 11px;
    margin-top: 3px;
    word-break: break-all;
}

.biz-source a {
    color: #5dade2;
}

.risk-card {
    padding: 6px 10px;
    background: rgba(255,255,255,0.03);
    border-radius: 6px;
    margin: 4px 0;
    border-left: 3px solid var(--border);
}

.risk-card.severity-high { border-left-color: #e74c3c; }
.risk-card.severity-medium { border-left-color: #f39c12; }
.risk-card.severity-low { border-left-color: #2ecc71; }

.risk-factor-name {
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
}

.risk-severity {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 10px;
    color: #fff;
    margin-left: 6px;
}

.risk-severity.high { background: #e74c3c; }
.risk-severity.medium { background: #f39c12; }
.risk-severity.low { background: #2ecc71; }

.risk-detail {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 3px;
    line-height: 1.4;
    word-break: break-word;
}

.clickable-name {
    color: var(--accent);
    cursor: pointer;
    text-decoration: none;
}

.clickable-name:hover {
    text-decoration: underline;
}

.offshore-flag {
    color: var(--pep-associated);
    font-size: 11px;
}

.confidence-bar {
    display: inline-block;
    width: 40px;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
    margin-left: 6px;
    vertical-align: middle;
}

.confidence-bar-fill {
    height: 100%;
    border-radius: 2px;
    background: var(--accent);
}

.external-link {
    display: inline-block;
    margin-top: 8px;
    color: var(--accent);
    font-size: 12px;
    text-decoration: none;
}

.external-link:hover {
    text-decoration: underline;
}

.career-timeline {
    position: relative;
    padding-left: 20px;
}

.career-timeline::before {
    content: '';
    position: absolute;
    left: 6px;
    top: 4px;
    bottom: 4px;
    width: 2px;
    background: var(--border);
}

.timeline-item {
    position: relative;
    padding-bottom: 16px;
    display: flex;
    gap: 12px;
}

.timeline-item:last-child {
    padding-bottom: 0;
}

.timeline-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--accent);
    border: 2px solid var(--bg-panel);
    flex-shrink: 0;
    margin-top: 3px;
    position: relative;
    z-index: 1;
}

.timeline-content {
    flex: 1;
    min-width: 0;
}

.timeline-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.timeline-meta {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.timeline-period {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

.term-badge {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 600;
    color: var(--accent);
    background: rgba(79, 195, 247, 0.15);
    border: 1px solid rgba(79, 195, 247, 0.3);
}

.appointment-type {
    display: inline-block;
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 9px;
    font-weight: 500;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border);
}

.change-icon {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #ecf0f1;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    background: #2980b9;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.change-icon.promotion {
    background: #27ae60;
}

.change-icon.transfer {
    background: #2980b9;
}

.change-icon.reelection {
    background: #e67e22;
}

.duration-badge {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 10px;
    font-size: 10px;
    color: #ecf0f1;
    background: #34495e;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.change-card {
    background: #1a252f;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: #ecf0f1;
    padding: 12px 14px;
    margin-bottom: 8px;
}

.position-level {
    display: inline-block;
    font-size: 10px;
    color: var(--text-muted);
    font-style: italic;
}

.news-list { display: flex; flex-direction: column; gap: 8px; }
.news-item { padding: 8px 12px; background: rgba(255,255,255,0.03); border-radius: 6px; border-left: 3px solid #f39c12; }
.news-title { color: #3498db; text-decoration: none; font-size: 14px; display: block; }
.news-title:hover { text-decoration: underline; }
.news-meta { color: #888; font-size: 12px; margin-top: 4px; display: block; }
.news-relationships { margin-top: 12px; }
.rel-item { display: flex; justify-content: space-between; padding: 4px 8px; background: rgba(255,255,255,0.02); border-radius: 4px; margin: 4px 0; }
.rel-type { color: #f39c12; font-weight: 600; font-size: 13px; }
.rel-confidence { color: #888; font-size: 12px; }

@media (max-width: 900px) {
    #sidebar {
        width: 260px;
        min-width: 260px;
    }
    #detail-panel {
        width: 320px;
        min-width: 320px;
    }
}

@media (max-width: 700px) {
    #app {
        flex-direction: column;
    }
    #investigation-view {
        flex-direction: column;
    }
    #sidebar {
        width: 100%;
        min-width: unset;
        max-height: 35vh;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }
    #graph-container {
        flex: 1;
        min-height: 30vh;
    }
    #detail-panel {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        min-width: unset;
        height: 100%;
        z-index: 200;
        border-left: none;
    }
    #detail-panel.hidden {
        display: none;
    }
    .detail-header {
        padding: 16px;
        position: sticky;
        top: 0;
        background: var(--bg-panel);
        z-index: 1;
    }
    #detail-content {
        padding: 12px 16px;
        padding-bottom: 40px;
    }
    .btn-icon {
        font-size: 28px;
        padding: 4px 8px;
    }
    #legend {
        bottom: 8px;
        right: 8px;
        padding: 8px 10px;
        font-size: 10px;
    }
    #legend h4 {
        font-size: 10px;
    }
    .legend-item, .legend-line {
        font-size: 10px;
        gap: 4px;
    }
    .sidebar-header {
        padding: 12px 16px;
    }
    .sidebar-header h1 {
        font-size: 15px;
    }
    .search-section {
        padding: 10px 16px;
    }
    .filters-section {
        padding: 10px 16px;
    }
    .stats-section {
        padding: 10px 16px;
    }
    .stats-grid {
        grid-template-columns: repeat(5, 1fr);
        gap: 4px;
    }
    .stat-card {
        padding: 6px 4px;
    }
    .stat-value {
        font-size: 14px;
    }
    .stat-label {
        font-size: 9px;
    }
    .results-section {
        padding: 10px 16px;
    }
    .screen-container {
        padding: 16px;
    }
    .screen-upload-area {
        grid-template-columns: 1fr;
    }
    .screen-table {
        font-size: 12px;
    }
    .screen-table td, .screen-table th {
        padding: 8px 6px;
    }
    .tab-btn {
        padding: 8px 16px;
        font-size: 13px;
    }
}

@media (max-width: 380px) {
    .search-bar {
        flex-direction: column;
    }
    #btn-search {
        width: 100%;
    }
    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.tab-bar {
    width: 100%;
    display: flex;
    background: var(--bg-panel);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.tab-btn {
    padding: 10px 24px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
}

.tab-btn:hover {
    color: var(--text-primary);
}

.tab-btn.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.tab-content {
    display: flex;
    flex: 1;
    min-height: 0;
}

.tab-content.hidden {
    display: none;
}

#investigation-view {
    flex: 1;
}

.screen-container {
    flex: 1;
    overflow-y: auto;
    padding: 30px;
    max-width: 960px;
    margin: 0 auto;
    width: 100%;
}

.screen-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 4px;
}

.screen-upload-area {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 20px;
}

.screen-upload-box {
    border: 2px dashed var(--border);
    border-radius: 8px;
    padding: 24px;
    text-align: center;
    background: var(--bg-input);
    transition: border-color 0.2s, background 0.2s;
    cursor: pointer;
}

.screen-upload-box.dragover {
    border-color: var(--accent);
    background: rgba(79, 195, 247, 0.06);
}

.drop-icon {
    font-size: 24px;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 8px;
}

.drop-text {
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.drop-or {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.drop-hint {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 8px;
}

#csv-file-input {
    font-size: 12px;
    color: var(--text-secondary);
}

.screen-json-box {
    display: flex;
    flex-direction: column;
}

.screen-json-box label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 6px;
    font-weight: 600;
}

.screen-json-box textarea {
    flex: 1;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    font-family: monospace;
    font-size: 13px;
    padding: 12px;
    resize: none;
    outline: none;
}

.screen-json-box textarea:focus {
    border-color: var(--accent);
}

.screen-actions {
    margin-top: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-primary {
    background: var(--accent);
    color: var(--bg-dark);
    font-weight: 700;
    padding: 10px 28px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: opacity 0.15s;
}

.btn-primary:hover {
    opacity: 0.85;
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#screen-loading {
    font-size: 13px;
    color: var(--accent);
}

.screen-summary {
    display: flex;
    gap: 20px;
    margin: 20px 0 12px;
    padding: 12px 16px;
    background: var(--bg-card);
    border-radius: 6px;
}

.screen-stat {
    font-size: 13px;
    color: var(--text-secondary);
}

.screen-stat strong {
    color: var(--accent);
    font-size: 16px;
}

.screen-table-wrap {
    overflow-x: auto;
}

.screen-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.screen-table thead th {
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.screen-table tbody tr {
    border-bottom: 1px solid rgba(42, 58, 92, 0.4);
    transition: background 0.1s;
}

.screen-table tbody tr:hover {
    background: rgba(79, 195, 247, 0.04);
}

.screen-table tbody tr.no-match {
    opacity: 0.5;
}

.screen-table td {
    padding: 10px 12px;
    vertical-align: top;
    color: var(--text-primary);
}

.screen-match-name {
    color: var(--accent);
    cursor: pointer;
    font-weight: 600;
}

.screen-match-name:hover {
    text-decoration: underline;
}

.screen-match-pos {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

.risk-bar {
    display: inline-block;
    width: 50px;
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
    margin-right: 6px;
    vertical-align: middle;
}

.risk-bar-fill {
    height: 100%;
    border-radius: 3px;
}

.risk-low { background: #2ecc71; }
.risk-medium { background: #f39c12; }
.risk-high { background: var(--warn); }

.flag-badge {
    display: inline-block;
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 600;
    margin-right: 3px;
    margin-bottom: 2px;
    white-space: nowrap;
}

.flag-pep { background: rgba(231, 76, 60, 0.2); color: var(--pep-direct); }
.flag-offshore { background: rgba(243, 156, 18, 0.2); color: var(--pep-associated); }
.flag-family { background: rgba(79, 195, 247, 0.15); color: var(--accent); }

.screen-history {
    margin-top: 30px;
}

.screen-history h3 {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
}

.history-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 12px;
    background: var(--bg-card);
    border-radius: 4px;
    margin-bottom: 4px;
    font-size: 12px;
    color: var(--text-secondary);
}

.history-item strong {
    color: var(--text-primary);
}

.graph-tool-btn { padding: 4px 10px; background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.15); border-radius: 4px; color: #aaa; cursor: pointer; font-size: 12px; }
.graph-tool-btn:hover { background: rgba(255, 255, 255, 0.15); color: #fff; }
.graph-tool-btn.active { background: rgba(79, 195, 247, 0.2); border-color: #4fc3f7; color: #4fc3f7; }
.cluster-legend { position: absolute; bottom: 16px; left: 12px; background: rgba(22, 33, 62, 0.95); border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 8px; padding: 10px; max-width: 200px; z-index: 10; }
.investigation-notes { width:100%; min-height:80px; background:rgba(255,255,255,0.05); border:1px solid rgba(255,255,255,0.1); border-radius:6px; color:#e0e0e0; padding:8px; font-size:13px; resize:vertical; font-family:inherit; }
.investigation-notes:focus { outline:none; border-color:#4fc3f7; }
.investigation-notes::placeholder { color:#5a6477; }

/* --- Version badge --- */
.sidebar-version {
    text-align: center;
    padding: 8px 0 12px;
    font-size: 11px;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    border-top: 1px solid var(--border);
    margin-top: 12px;
}

/* --- Changelog --- */
.changelog-release {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 16px;
}

.changelog-version-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.changelog-version-tag {
    background: var(--accent);
    color: #fff;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
}

.changelog-date {
    color: var(--text-muted);
    font-size: 12px;
}

.changelog-title {
    font-size: 16px;
    color: var(--text-primary);
    margin: 0 0 12px;
}

.changelog-list {
    margin: 0;
    padding-left: 20px;
}

.changelog-list li {
    font-size: 13px;
    color: var(--text-secondary);
    padding: 3px 0;
    line-height: 1.6;
}

/* --- Subscribe input --- */
.subscribe-input:focus {
    outline: none;
    border-color: var(--accent);
}

/* --- Tag Reference Accordion --- */
.tag-ref-sections {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.tag-ref-accordion {
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg-panel);
}

.tag-ref-accordion-header {
    display: flex;
    align-items: center;
    padding: 14px 18px;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s;
}

.tag-ref-accordion-header:hover {
    background: rgba(255,255,255,0.03);
}

.tag-ref-accordion-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
}

.tag-ref-accordion-count {
    font-size: 12px;
    color: var(--text-muted);
    margin-right: 12px;
}

.tag-ref-accordion-arrow {
    font-size: 11px;
    color: var(--text-muted);
    transition: transform 0.2s;
}

.tag-ref-accordion.open .tag-ref-accordion-arrow {
    transform: rotate(90deg);
}

.tag-ref-accordion-body {
    display: none;
    padding: 0 18px 14px;
}

.tag-ref-accordion.open .tag-ref-accordion-body {
    display: block;
}

.tag-ref-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.tag-ref-table thead th {
    text-align: left;
    padding: 8px 10px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    font-weight: 500;
    font-size: 12px;
}

.tag-ref-table tbody tr {
    border-bottom: 1px solid rgba(255,255,255,0.04);
}

.tag-ref-table tbody tr:last-child {
    border-bottom: none;
}

.tag-ref-table tbody td {
    padding: 8px 10px;
    color: var(--text-secondary);
    vertical-align: top;
}

.tag-ref-code {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-family: "SF Mono", "Fira Code", monospace;
    background: rgba(79,195,247,0.1);
    color: var(--accent);
    white-space: nowrap;
}

.tag-ref-desc {
    color: var(--text-secondary);
    line-height: 1.5;
}
