/* =========================================
   1. VARIABLES & RESET
   ========================================= */
:root {
    --bg-color: #1a1a1a;         /* Fundo Principal */
    --panel-color: #2b2b2b;      /* Fundo de Painéis/Cards */
    --input-bg: #343638;         /* Fundo de Inputs */
    --text-main: #eaeaea;        /* Texto Principal */
    --text-muted: #a0a0a0;       /* Texto Secundário */

    --accent-blue: #1f6aa5;      /* Botão Padrão/Selecionado */
    --accent-blue-hover: #144870;

    --accent-green: #22c55e;     /* Botão Apply/Copy */
    --accent-orange: #f59e0b;    /* Botão Generate/Avisos */
    --accent-red: #dc2626;       /* Botão Clear/Cancel */

    --accent-purple: #a855f7;    /* Reverser True Ancestry */
    --accent-yellow: #facc15;    /* Destaque de valores */

    --border-color: #3a3a3a;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    overflow: hidden; /* Scroll é gerenciado internamente */
}

/* =========================================
   2. NAVIGATION BAR
   ========================================= */
.navbar {
    background-color: #000;
    padding: 10px 20px;
    display: flex;
    gap: 10px;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.85rem;
    overflow-x: auto; /* Permite scroll se a tela for pequena */
    flex-shrink: 0;
    white-space: nowrap;
}

.navbar a {
    color: var(--text-muted);
    text-decoration: none;
    padding: 8px 12px;
    border-radius: 4px;
    transition: all 0.2s ease;
    text-transform: uppercase;
    font-weight: 600;
    font-size: 0.8rem;
    cursor: pointer;
}

.navbar a:hover {
    background-color: #333;
    color: #fff;
}

.navbar a.active {
    background-color: var(--accent-blue);
    color: #fff;
}

/* =========================================
   3. MAIN LAYOUT & SECTIONS
   ========================================= */
.container {
    padding: 20px 40px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    min-width: 0;
    position: relative;
}

/* Animação suave ao trocar de aba */
.view-section {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    height: 100%;
    min-width: 0;
    overflow-x: hidden;
    animation: fadeIn 0.3s ease;
    position: relative;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

.header-info {
    text-align: center;
    margin-bottom: 20px;
    color: var(--text-muted);
}

.header-info h2 {
    color: var(--text-main);
    margin-bottom: 5px;
}

/* =========================================
   4. INPUTS & CONTROLS
   ========================================= */
label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

input[type="text"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: 10px;
    background-color: var(--input-bg);
    border: 1px solid var(--border-color);
    color: white;
    border-radius: 4px;
    font-size: 0.95rem;
    outline: none;
    font-family: inherit;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--accent-blue);
}

.data-area {
    font-family: 'Consolas', monospace;
    resize: none; /* Layout fixo */
}

#horizInputArea {
    width: 320px;
    max-width: 100%;
    height: 360px;
    align-self: flex-start;
    resize: vertical;
}

@media (max-width: 700px) {
    #horizInputArea {
        width: 100%;
        height: 280px;
    }
}

/* Utilitário de altura total para editores */
.full-height {
    flex-grow: 1;
    min-height: 400px;
}

/* Linha de controles (Botões ao lado de inputs) */
.inline-controls {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
    align-items: flex-end;
}

.search-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: var(--panel-color);
    border-radius: 20px;
    padding: 6px 10px;
    margin-bottom: 10px;
}
.search-bar label {
    font-size: 0.85rem;
    color: var(--text-muted);
}
.search-bar input {
    width: 300px;
}

.input-group, .input-group-small {
    display: flex;
    flex-direction: column;
}

.input-group-small input {
    width: 80px;
    text-align: center;
}

/* =========================================
   5. BUTTONS
   ========================================= */
button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    border-radius: 4px;
    font-weight: bold;
    text-transform: uppercase;
    transition: background 0.2s;
    font-size: 0.85rem;
    padding: 10px 20px;
}
button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.blue-btn { background-color: var(--accent-blue); color: white; }
.blue-btn:hover { background-color: var(--accent-blue-hover); }
.blue-btn:disabled { background-color: #333; color: #777; cursor: not-allowed; }

.green-btn { background-color: var(--accent-green); color: #000; }
.green-btn:hover { filter: brightness(1.1); }

.orange-btn { background-color: var(--accent-orange); color: #000; }
.orange-btn:hover { filter: brightness(1.1); }

.red-btn { background-color: var(--accent-red); color: white; }
.red-btn:hover { filter: brightness(1.1); }

.full-width { width: 100%; }
.small-btn { padding: 8px 12px; }
.big-btn { padding: 20px 40px; font-size: 1.1rem; min-width: 200px; }

/* =========================================
   6. MODULE: DATA TAB
   ========================================= */
.data-load-container {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-top: 50px;
}

.load-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.count-display {
    font-size: 1.1rem;
    color: var(--text-muted);
}
.count-display span {
    color: var(--accent-blue);
    font-weight: bold;
}

.preset-calc-panel {
    margin-top: 18px;
    padding: 14px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: #1a1f2a;
}

.preset-calc-title {
    color: #dbeafe;
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 10px;
}

.preset-calc-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.preset-calc-select {
    min-width: 360px;
    flex: 1;
}

.source-editor-locked {
    opacity: 0.72;
}

.data-source-picker-panel {
    margin-top: 12px;
}

.data-source-picker-grid {
    display: grid;
    grid-template-columns: 1.6fr 1fr;
    gap: 10px;
}

.data-source-picker-col {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 0;
}

#dataSourcePickerDropdown {
    min-height: 220px;
    border-radius: 8px;
}

.data-source-picker-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.data-source-picker-mode-tabs {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin: 0 0 10px;
}

.data-source-mode-btn {
    border: 1px solid #3b6791;
    background: linear-gradient(180deg, #163c5b 0%, #122f49 100%);
    color: #dceeff;
    border-radius: 10px;
    padding: 8px 12px;
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.045em;
    cursor: pointer;
    transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.data-source-mode-btn:hover {
    transform: translateY(-1px);
    border-color: #5f8ebd;
    box-shadow: 0 6px 16px rgba(7, 21, 35, 0.24);
}

.data-source-mode-btn.active {
    background: linear-gradient(180deg, #1f6aa5 0%, #1a598a 100%);
    border-color: #7bb6df;
    color: #ffffff;
    box-shadow: 0 7px 18px rgba(12, 44, 70, 0.30);
}

.reverser-source-mode-row {
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.rev-source-mode-tabs {
    margin: 0;
}
/* =========================================
   7. MODULE: SINGLE & DISTANCE (Sidebar Layout)
   ========================================= */
.sidebar-layout {
    display: flex;
    height: 100%;
    gap: 20px;
    overflow: hidden;
    min-width: 0;
}

.sidebar-panel {
    width: 280px;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    border-right: 1px solid #333;
    padding-right: 20px;
    overflow-y: auto;
    min-width: 0;
}

.main-panel {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    position: relative;
    padding-bottom: 20px;
    min-width: 0;
}

/* Headers de coluna */
.col-header {
    font-size: 0.9rem;
    font-weight: bold;
    color: var(--text-muted);
    border-bottom: 1px solid #333;
    padding-bottom: 5px;
    margin-bottom: 10px;
}

/* Lista de seleção (Checkbox like) */
.list-container {
    background-color: var(--panel-color);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 5px;
    overflow-y: auto;
    overflow-x: hidden;
}

.checkbox-item {
    display: flex;
    align-items: center;
    padding: 6px 10px;
    border-bottom: 1px solid #2a2a2a;
    cursor: pointer;
    font-size: 0.9rem;
    min-width: 0;
}
.checkbox-item:hover { background-color: #252525; }
.checkbox-item input { margin-right: 10px; cursor: pointer; }

#singleTargetList {
    min-height: 150px;
}

#singleTargetList .checkbox-item {
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

#singleTargetList:empty::before {
    content: "Load TARGET data in the DATA tab to populate this list.";
    display: block;
    padding: 10px 8px;
    color: var(--text-muted);
    font-size: 0.82rem;
    line-height: 1.3;
}

/* Parâmetros Single */
.param-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}
.param-row input, .param-row select { width: 110px; }
.dark-select { padding: 6px; }

/* =========================================
   ATUALIZAÇÃO: SINGLE TAB RESULTS (MATCH PRINT)
   ========================================= */

/* Card Principal do Resultado */
.single-res-card {
    background-color: var(--panel-color);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 20px;
    margin-bottom: 20px;
    position: relative; /* Para posicionar o botão Copy absoluto se quiser, ou flex */
}

/* Header: Target Name + Distance + Copy Button */
.res-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid #333;
    padding-bottom: 10px;
}

.res-target-name {
    font-size: 1.1rem;
    font-weight: bold;
    color: #fff;
}

.res-dist {
    font-family: 'Consolas', monospace;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.copy-mini-btn {
    background-color: var(--accent-blue);
    color: white;
    padding: 4px 10px;
    font-size: 0.75rem;
    border-radius: 3px;
    border: none;
    cursor: pointer;
    text-transform: uppercase;
}
.copy-mini-btn:hover { background-color: var(--accent-blue-hover); }

.res-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.snap-mini-btn {
    background: linear-gradient(135deg, #0ea5e9, #2563eb);
    color: #fff;
    padding: 4px 10px;
    font-size: 0.75rem;
    border-radius: 3px;
    border: none;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    white-space: nowrap;
}
.snap-mini-btn:hover { filter: brightness(1.05); }

.res-body {
    max-width: 720px;
    width: 100%;
}

/* Grupos (Ex: Europe, Americas) */
.group-section {
    margin-bottom: 15px;
    max-width: 720px;
    width: 100%;
}

.group-header {
    display: flex;
    justify-content: space-between;
    font-weight: bold;
    color: #e0e0e0;
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.group-total {
    color: var(--accent-blue); /* Azul para a % total */
}

/* Linhas Individuais (Populações) */
.pop-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 160px;
    column-gap: 16px;
    align-items: center;
    padding: 4px 0;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.single-delete-controls {
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.single-delete-controls .single-delete-mode-btn {
    margin-top: 0 !important;
    flex: 1;
}
.single-delete-help-btn {
    flex: 0 0 auto;
}
.single-delete-mode-btn {
    background: #2f1717;
    border: 1px solid #7f1d1d;
}
.single-delete-mode-btn.active {
    background: linear-gradient(135deg, #7f1d1d, #b91c1c);
    border-color: #ef4444;
}
.single-delete-notice {
    margin-top: 8px;
    border: 1px solid rgba(239, 68, 68, 0.45);
    background: rgba(127, 29, 29, 0.22);
    color: #fecaca;
    border-radius: 6px;
    padding: 8px 10px;
    font-size: 0.78rem;
    line-height: 1.35;
}
.single-ethnic-toggle-row {
    margin-top: 8px;
    border: 1px solid #35506f;
    background: rgba(31, 106, 165, 0.12);
    border-radius: 6px;
    padding: 8px 10px;
}

.single-ethnic-toggle-row label {
    margin: 0;
    color: #e4edf7;
    font-weight: 700;
    letter-spacing: 0.03em;
    font-size: 0.78rem;
}

.single-ethnic-map-notice {
    margin-top: 8px;
    border: 1px solid rgba(245, 158, 11, 0.45);
    background: rgba(120, 67, 7, 0.22);
    color: #fde68a;
    border-radius: 6px;
    padding: 8px 10px;
    font-size: 0.78rem;
    line-height: 1.35;
}

.single-result-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(340px, 0.95fr);
    gap: 16px;
    align-items: start;
}

.single-ethnic-map-shell {
    background: #232a33;
    border: 1px solid #334155;
    border-radius: 8px;
    padding: 10px;
}

.single-ethnic-map-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
    font-size: 0.8rem;
    font-weight: 700;
    color: #dbeafe;
}

.single-ethnic-map-count {
    color: #93c5fd;
    font-size: 0.74rem;
}

.single-ethnic-map-canvas {
    width: 100%;
    height: 330px;
    border: 1px solid #334155;
    border-radius: 6px;
    overflow: hidden;
    background: #0f172a;
}

.single-ethnic-map-empty {
    min-height: 120px;
    border: 1px dashed #475569;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 12px;
    color: #94a3b8;
    font-size: 0.78rem;
}

.single-map-result-card {
    background: #f4f8fc;
    border: 1px solid #d7e4f2;
    border-radius: 16px;
    box-shadow: 0 18px 42px rgba(9, 28, 46, 0.18);
    padding: 0;
    overflow: hidden;
}

.single-map-shell {
    background: linear-gradient(180deg, #fbfdff 0%, #f3f8ff 100%);
}

.single-map-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    padding: 18px 22px 14px;
    border-bottom: 1px solid #e2ebf5;
    background: rgba(255, 255, 255, 0.92);
}

.single-map-head-left {
    min-width: 0;
}
.single-map-head-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
    min-width: 260px;
}

.single-map-unmapped-warning {
    max-width: 360px;
    border: 1px solid #f5d59f;
    background: #fff4df;
    color: #8a5a15;
    border-radius: 10px;
    padding: 8px 10px;
    font-size: 0.72rem;
    line-height: 1.35;
    font-weight: 700;
    box-shadow: 0 4px 10px rgba(201, 145, 53, 0.16);
    text-align: left;
}

.single-map-unmapped-preview {
    margin-top: 4px;
    font-weight: 600;
    color: #6e4d17;
    font-size: 0.69rem;
}


.single-map-brand {
    font-size: 0.78rem;
    letter-spacing: 0.12em;
    font-weight: 700;
    text-transform: uppercase;
    color: #2d6cc3;
}

.single-map-target {
    margin-top: 4px;
    font-size: 1.32rem;
    font-weight: 800;
    color: #0f172a;
    word-break: break-word;
}

.single-map-distance {
    margin-top: 8px;
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 5px 12px;
    font-size: 0.75rem;
    font-family: 'Consolas', 'Courier New', monospace;
    font-weight: 700;
    color: #315882;
    background: #eaf3ff;
    border: 1px solid #c8dbf5;
}

.single-map-result-card .res-actions {
    align-self: flex-start;
}

.single-map-result-card .copy-mini-btn,
.single-map-result-card .snap-mini-btn {
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 0.68rem;
    letter-spacing: 0.04em;
    font-weight: 700;
    border: 1px solid transparent;
    white-space: nowrap;
}

.single-map-result-card .copy-mini-btn {
    background: #eef4fb;
    border-color: #c5d5e9;
    color: #1e3a5f;
}

.single-map-result-card .copy-mini-btn:hover {
    background: #e5eef8;
}

.single-map-result-card .snap-mini-btn {
    background: linear-gradient(135deg, #2f79d6, #2665bd);
}

.single-map-layout {
    display: grid;
    grid-template-columns: minmax(560px, 42%) minmax(0, 1fr);
    min-height: 620px;
}

.single-map-sidebar {
    background: #f7fbff;
    border-right: 1px solid #dce8f5;
    padding: 20px 18px;
    overflow-y: auto;
}

.single-map-sidebar-title {
    font-size: 1.26rem;
    font-weight: 800;
    color: #1d3553;
    margin-bottom: 4px;
}

.single-map-sidebar-sub {
    font-size: 0.94rem;
    color: #5c6f87;
    margin-bottom: 12px;
}
.single-map-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 10px;
}

.single-map-oracle-wrap {
    margin-bottom: 12px;
    border: 1px solid #d9e6f3;
    border-radius: 12px;
    background: linear-gradient(180deg, #ffffff 0%, #f5f9ff 100%);
    padding: 10px;
}

.single-map-oracle-title {
    font-size: 0.75rem;
    font-weight: 800;
    color: #2d547f;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 8px;
}

.single-map-oracle {
    position: relative;
    min-height: 170px;
    margin: 4px 0 12px;
    display: flex;
    justify-content: flex-start;
    align-items: flex-start;
}

.single-map-oracle-stage {
    position: relative;
    width: min(172px, 100%);
    margin: 0;
}

.single-map-oracle-svg {
    width: 100%;
    height: auto;
    display: block;
}

.single-oracle-segment {
    cursor: pointer;
    transition: transform 0.14s ease, filter 0.14s ease, opacity 0.14s ease;
    transform-origin: center;
}

.single-oracle-segment:hover {
    filter: brightness(1.08) saturate(1.06);
}

.single-oracle-center {
    pointer-events: none;
}

.single-oracle-center-main {
    font-size: 1.48rem;
    font-weight: 900;
    letter-spacing: 0.02em;
    fill: #23466f;
    text-anchor: middle;
}

.single-oracle-center-sub {
    font-size: 0.64rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    fill: #53759a;
    text-anchor: middle;
    text-transform: uppercase;
}

.single-oracle-tooltip {
    position: absolute;
    z-index: 3;
    max-width: 220px;
    pointer-events: none;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.12s ease, transform 0.12s ease;
    border: 1px solid #c8d9ec;
    background: rgba(255, 255, 255, 0.98);
    border-radius: 10px;
    box-shadow: 0 8px 20px rgba(27, 58, 93, 0.22);
    padding: 6px 8px;
    color: #1f3f63;
    font-size: 0.72rem;
    line-height: 1.3;
    font-weight: 700;
}

.single-oracle-tooltip.show {
    opacity: 1;
    transform: translateY(0);
}

.single-oracle-modal {
    position: absolute;
    z-index: 4;
    min-width: 190px;
    max-width: 260px;
    opacity: 0;
    pointer-events: none;
    transform: scale(0.96);
    transition: opacity 0.14s ease, transform 0.14s ease;
    border: 1px solid #bfd4eb;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 10px 26px rgba(17, 45, 78, 0.24);
    padding: 10px;
}

.single-oracle-modal.show {
    opacity: 1;
    pointer-events: auto;
    transform: scale(1);
}

.single-oracle-modal-title {
    font-size: 0.78rem;
    font-weight: 800;
    color: #1f456e;
    line-height: 1.3;
    margin-bottom: 6px;
}

.single-oracle-modal-pct {
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 0.76rem;
    font-weight: 800;
    color: #2f6aa7;
}

.single-oracle-modal-meta {
    margin-top: 5px;
    font-size: 0.68rem;
    color: #5d7fa6;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.single-oracle-color {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 6px;
    vertical-align: -1px;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.85), 0 0 0 3px rgba(55, 92, 133, 0.25);
}

.single-map-view-btn {
    border: 1px solid #c7d8ec;
    background: #f2f7fe;
    color: #355a86;
    border-radius: 999px;
    padding: 9px 12px;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 800;
    cursor: pointer;
}

.single-map-view-btn.active {
    color: #ffffff;
    background: linear-gradient(135deg, #2f79d6, #2a67be);
    border-color: #2f79d6;
    box-shadow: 0 5px 12px rgba(45, 117, 206, 0.3);
}

.single-map-summary {
    margin-bottom: 10px;
    font-size: 0.98rem;
    font-weight: 800;
    color: #365a85;
    text-transform: uppercase;
    letter-spacing: 0.07em;
}

.single-map-list {
    display: none;
}

.single-map-list.active {
    display: block;
}


.single-map-group {
    border: 1px solid #dce8f5;
    border-radius: 10px;
    background: #ffffff;
    margin-bottom: 10px;
    overflow: hidden;
}

.single-map-group-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: linear-gradient(180deg, #eef5ff 0%, #e6f0fd 100%);
    color: #173a66;
    font-size: 0.95rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.single-map-group-head span:last-child {
    min-width: 76px;
    text-align: right;
}

.single-map-row {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: center;
    padding: 9px 12px;
    border-top: 1px solid #edf3fb;
}

.single-map-row-left {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex: 1 1 auto;
    max-width: calc(100% - 86px);
}

.single-map-dot {
    width: 11px;
    height: 11px;
    border-radius: 999px;
    flex: 0 0 auto;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.9), 0 0 0 3px rgba(61, 97, 140, 0.2);
}

.single-map-name {
    font-size: 1.02rem;
    font-weight: 650;
    color: #24364d;
    white-space: normal;
    word-break: normal;
    overflow-wrap: break-word;
}

.single-map-pct {
    font-family: 'Consolas', 'Courier New', monospace;
    color: #1f4d82;
    font-size: 0.98rem;
    font-weight: 800;
    min-width: 64px;
    text-align: right;
    flex: 0 0 64px;
}

.single-map-empty-list {
    border: 1px dashed #c7d8eb;
    border-radius: 10px;
    padding: 14px;
    text-align: center;
    color: #60758f;
    font-size: 0.8rem;
    background: #ffffff;
}

.single-map-canvas-wrap {
    padding: 14px;
    background: linear-gradient(180deg, #eef4fb 0%, #e8f0fa 100%);
    display: flex;
    flex-direction: column;
    min-height: 620px;
}

.single-map-canvas-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    font-size: 0.82rem;
    font-weight: 800;
    color: #2b4f78;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.single-map-canvas-large {
    flex: 1;
    min-height: 620px;
    height: calc(100vh - 290px);
    max-height: 820px;
    border-radius: 14px;
    border: 1px solid #d0deef;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.75), 0 10px 24px rgba(20, 48, 84, 0.16);
    background: #f4f8fc;
}

.single-map-result-card .single-ethnic-map-empty {
    flex: 1;
    min-height: 420px;
    border: 1px dashed #b8cadf;
    color: #516a89;
    background: #f8fbff;
    border-radius: 12px;
}

.single-ethnic-pin {
    background: transparent !important;
    border: none !important;
}

.single-ethnic-pin-dot {
    --eth-pin: #5B8DEF;
    width: 12px;
    height: 12px;
    display: block;
    background: var(--eth-pin);
    border: 2px solid rgba(255, 255, 255, 0.95);
    border-radius: 2px;
    transform: rotate(45deg);
    box-shadow: 0 0 0 1px rgba(25, 41, 66, 0.26), 0 2px 6px rgba(16, 36, 66, 0.35);
}

@media (max-width: 1520px) {
    .single-map-layout {
        grid-template-columns: minmax(500px, 44%) minmax(0, 1fr);
    }
}

@media (max-width: 1180px) {
    .single-map-layout {
        grid-template-columns: 1fr;
    }
    .single-map-head-right {
        width: 100%;
        align-items: flex-start;
        min-width: 0;
    }
    .single-map-unmapped-warning {
        max-width: none;
        width: 100%;
    }
    .single-map-sidebar {
        max-height: 320px;
    }
    .single-map-canvas-wrap,
    .single-map-canvas-large {
        min-height: 520px;
        height: 520px;
        max-height: 620px;
    }
}

@media (max-width: 1280px) {
    .single-result-layout {
        grid-template-columns: 1fr;
    }
    .single-ethnic-map-canvas {
        height: 280px;
    }
}

#singleResults.single-delete-mode-active .single-res-card[data-aggregate="0"] .pop-row[data-source-encoded] {
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.14s ease, transform 0.14s ease;
}
#singleResults.single-delete-mode-active .single-res-card[data-aggregate="0"] .pop-row[data-source-encoded]:hover {
    background: rgba(185, 28, 28, 0.18);
    transform: translateX(2px);
}

#singleResults.single-delete-mode-active .single-map-list-raw.active .single-map-row-deletable {
    cursor: pointer;
    transition: background-color 0.14s ease, transform 0.14s ease, box-shadow 0.14s ease;
}

#singleResults.single-delete-mode-active .single-map-list-raw.active .single-map-row-deletable:hover {
    background: rgba(236, 72, 153, 0.12);
    transform: translateY(-1px) scale(1.015);
    box-shadow: 0 4px 10px rgba(30, 58, 138, 0.18);
}
.pop-row.pop-row-removed {
    opacity: 0.45;
}

.pop-name {
    padding-left: 15px; /* Indentação */
    color: var(--text-main);
    font-weight: 600;
}

.pop-stats {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    justify-content: flex-start;
}

.pop-pct {
    font-family: 'Consolas', monospace;
    color: #e6e6e6;
}

/* Barra de Progresso Visual */
.pop-bar-track {
    width: 80px;
    height: 8px;
    background-color: #333;
    border-radius: 4px;
    overflow: hidden;
}

.pop-bar-fill {
    height: 100%;
    background-color: var(--accent-orange); /* Laranja conforme o print */
    border-radius: 4px;
}

/* Tabela Distance */
.dist-run-title {
    font-size: 1.02rem;
    font-weight: 800;
    letter-spacing: 0.2px;
    color: #e8f7ff;
    margin: 0 0 10px;
    padding: 8px 12px;
    border: 1px solid rgba(31, 106, 165, 0.55);
    border-left: 4px solid #22c55e;
    border-radius: 8px;
    background: linear-gradient(90deg, rgba(31, 106, 165, 0.30), rgba(31, 106, 165, 0.12) 60%, rgba(20, 72, 112, 0.08));
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04), 0 4px 12px rgba(0, 0, 0, 0.20);
    text-shadow: 0 0 8px rgba(31, 106, 165, 0.35);
}

.table-header, .dist-row {
    display: grid;
    grid-template-columns: 100px 1fr;
    padding: 8px 10px;
}
.table-header { background: #222; font-weight: bold; border-bottom: 1px solid #444; }
.dist-row { border-bottom: 1px solid #222; }
.table-body { overflow-y: auto; flex-grow: 1; background: var(--panel-color); }
.dist-val { color: var(--accent-orange); font-family: monospace; }

/* Distance Screenshot */
.distance-snapshot {
    position: fixed;
    left: -10000px;
    top: 0;
    width: 860px;
    background: linear-gradient(160deg, #eef5ff 0%, #e8f0ff 55%, #e2ebfb 100%);
    color: #0f172a;
    padding: 20px;
    z-index: 9999;
}

.dist-snap-brand {
    width: 100%;
    text-align: center;
    font-size: 1.06rem;
    font-weight: 800;
    letter-spacing: 0.30em;
    color: #1f6aa5;
    opacity: 0.76;
    margin-bottom: 12px;
    font-family: 'Inter', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

.dist-snap-card {
    background: #ffffff;
    border: 1px solid #d9e5f5;
    border-radius: 18px;
    padding: 20px 24px 22px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.14);
    font-family: 'Inter', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

.dist-snap-toprow {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    column-gap: 16px;
    margin-bottom: 8px;
}

.dist-snap-kicker {
    font-size: 0.80rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #2563eb;
}

.dist-snap-title {
    font-size: 1.52rem;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.16;
    margin: 0 0 10px;
    overflow-wrap: anywhere;
}

.dist-snap-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}

.dist-snap-subline {
    font-size: 0.88rem;
    font-weight: 700;
    color: #1f3f6f;
    letter-spacing: 0;
}

.dist-snap-subline-soft {
    color: #475569;
    font-weight: 600;
}


.dist-snap-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    border-top: 1px solid #e8eef7;
    border-bottom: 1px solid #e8eef7;
    background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
    border-radius: 12px;
    overflow: hidden;
    padding: 4px;
}

.dist-snap-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 120px;
    align-items: center;
    column-gap: 14px;
    padding: 10px 12px;
    border-bottom: 1px dashed #e2e8f0;
    border-radius: 10px;
    font-size: 0.95rem;
    margin-bottom: 4px;
}

.dist-snap-row:last-child {
    border-bottom: none;
}

.dist-snap-left {
    min-width: 0;
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr);
    align-items: center;
    column-gap: 10px;
}

.dist-snap-right {
    min-width: 0;
    display: block;
}

.dist-snap-idx {
    width: 28px;
    height: 28px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.80rem;
    font-weight: 800;
    color: #1e293b;
    background: #e8effb;
    border: 1px solid #d6e1f3;
}

.dist-snap-name {
    font-weight: 700;
    color: #0b1220;
    overflow-wrap: anywhere;
    line-height: 1.25;
    text-shadow: 0 0 0.01px rgba(11, 18, 32, 0.01);
}

.dist-snap-val {
    font-family: 'JetBrains Mono', 'Consolas', monospace;
    text-align: right;
    font-weight: 800;
}


.dist-snap-logo {
    justify-self: end;
    width: 46px;
    height: 46px;
    object-fit: contain;
    border-radius: 999px;
    border: 1px solid #dbe5f2;
    background: #ffffff;
    padding: 2px;
    box-sizing: border-box;
}


/* =========================================
   8. MODULE: PER-PC & PCA MAP
   ========================================= */
.pc-card {
    background-color: var(--panel-color);
    border: 1px solid var(--border-color);
    margin-bottom: 10px; padding: 10px; border-radius: 4px;
}
.pc-title {
    color: var(--accent-blue); font-weight: bold;
    border-bottom: 1px solid #333; margin-bottom: 5px;
}
.pc-row {
    display: flex; justify-content: space-between;
    font-family: 'Consolas', monospace; font-size: 0.85rem;
}

.pca-plot-bg {
    background-color: #fff;
    border: 1px solid #ccc;
    display: flex; align-items: stretch; justify-content: stretch;
    flex-grow: 1; overflow: hidden;
}
#pcaPlotWrapper {
    position: relative;
    width: 100%;
    height: 100%;
    background: #fff;
}
#pcaCanvas {
    width: 100%;
    height: 100%;
}

/* =========================================
   9. MODULE: MANUAL MIXER
   ========================================= */
.manual-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    height: 100%;
}
.manual-col { display: flex; flex-direction: column; gap: 10px; }
.add-row { display: flex; gap: 10px; }
.flex-grow { flex-grow: 1; }

.queue-list {
    background-color: var(--panel-color);
    border: 1px solid var(--border-color);
    flex-grow: 1;
    padding: 10px;
    overflow-y: auto;
}
.queue-item {
    display: flex; justify-content: space-between;
    background-color: #252525; padding: 8px; margin-bottom: 5px; border-radius: 3px;
}
.remove-x { color: var(--accent-red); cursor: pointer; font-weight: bold; padding: 0 5px; }
.yellow-text { color: var(--accent-yellow); font-family: monospace; font-weight: bold; }

.fill-options {
    background: #1a1a1a; padding: 10px; border-radius: 4px;
    display: flex; flex-direction: column; gap: 8px;
}
.radio-item { display: flex; align-items: center; gap: 10px; font-size: 0.9rem; }
.radio-item input { width: auto; transform: scale(1.2); cursor: pointer; }

.manual-subtab-nav {
    display: grid;
    grid-template-columns: repeat(4, minmax(220px, 1fr));
    gap: 10px;
    margin-bottom: 10px;
}

.manual-subtab-guide {
    border: 1px solid #2b4e74;
    border-radius: 12px;
    background: linear-gradient(180deg, rgba(16, 43, 71, 0.85) 0%, rgba(12, 31, 52, 0.82) 100%);
    padding: 10px 12px;
    margin-bottom: 12px;
    box-shadow: 0 6px 18px rgba(3, 12, 24, 0.28);
}
.manual-subtab-guide-title {
    color: #e2efff;
    font-weight: 800;
    letter-spacing: 0.03em;
    font-size: 0.9rem;
    margin-bottom: 8px;
}
.manual-subtab-guide-steps {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.manual-subtab-guide-steps span {
    background: rgba(36, 87, 136, 0.3);
    border: 1px solid rgba(101, 168, 233, 0.35);
    border-radius: 999px;
    color: #d7e9ff;
    font-size: 0.82rem;
    font-weight: 700;
    padding: 4px 10px;
}
.manual-steps-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: -2px;
}
.manual-steps-inline span {
    background: rgba(37, 95, 153, 0.24);
    border: 1px solid rgba(109, 170, 230, 0.36);
    color: #d9ecff;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 0.8rem;
    font-weight: 700;
}

.coord-editor-source-shell {
    border: 1px solid #2b3f59;
    border-radius: 12px;
    padding: 10px;
    background: linear-gradient(180deg, rgba(14,31,54,0.92) 0%, rgba(11,24,42,0.9) 100%);
    margin-bottom: 12px;
}
.coord-editor-source-header {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    margin-bottom: 10px;
}
.coord-editor-source-header .coord-editor-warning {
    flex: 1;
    margin-bottom: 0;
}
.coord-editor-collapse-btn {
    flex: 0 0 auto;
    white-space: nowrap;
}
.coord-editor-source-body {
    display: block;
}
.coord-editor-source-shell.collapsed .coord-editor-source-header {
    margin-bottom: 0;
}
.coord-editor-source-shell.collapsed .coord-editor-source-body {
    display: none;
}
.coord-editor-warning {
    background: rgba(255, 205, 86, 0.14);
    border: 1px solid rgba(255, 205, 86, 0.55);
    color: #ffeaa7;
    border-radius: 10px;
    padding: 8px 10px;
    font-weight: 700;
    margin-bottom: 10px;
}
.coord-editor-source-top {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}
.coord-editor-source-mode {
    color: #d7e8ff;
    font-weight: 600;
}
.coord-editor-source-helper {
    margin-top: 8px;
    color: #9fc8ff;
    font-size: 0.92rem;
}
.coord-editor-source-picker {
    display: grid;
    grid-template-columns: 1.6fr 1fr;
    gap: 10px;
    margin-top: 10px;
}
.coord-editor-source-picker-col {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 0;
}
#coordEditorSourceDropdown {
    min-height: 220px;
    border-radius: 8px;
}
.coord-editor-selected {
    min-height: 170px;
    max-height: 220px;
    overflow: auto;
    border: 1px solid #27466a;
    border-radius: 8px;
    padding: 8px;
    background: #091a2f;
}
.coord-editor-selected-empty {
    color: #9fb6d8;
    font-size: 0.88rem;
}
.coord-editor-selected-count {
    color: #d6e7ff;
    font-size: 0.9rem;
    font-weight: 700;
}
.coord-editor-selected-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 6px;
    background: #132742;
    border: 1px solid #2a4f7c;
    border-radius: 7px;
    padding: 6px 8px;
    margin-bottom: 6px;
}
.coord-editor-selected-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #e8f1ff;
    font-weight: 600;
}
.coord-editor-selected-remove {
    width: 22px;
    height: 22px;
    border-radius: 999px;
    border: 1px solid #5a2d2d;
    background: #351414;
    color: #ff8c8c;
    cursor: pointer;
    font-weight: 800;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}
.manual-subtab-headline {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}
.manual-subtab-title {
    color: #cfe2ff;
    font-weight: 800;
    letter-spacing: 0.02em;
}
.manual-subtab-btn {
    background: linear-gradient(180deg, #18273a 0%, #131f30 100%);
    color: #cfe2ff;
    border: 1px solid #2b3a4e;
    border-radius: 10px;
    padding: 10px 12px;
    font-weight: 700;
    letter-spacing: 0.01em;
    cursor: pointer;
    text-align: left;
    min-height: 86px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}
.manual-subtab-kicker {
    color: #83b7ea;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.08em;
}
.manual-subtab-main {
    color: #e9f2ff;
    font-size: 0.9rem;
    font-weight: 800;
    line-height: 1.2;
}
.manual-subtab-desc {
    color: #b8d2ee;
    font-size: 0.76rem;
    line-height: 1.2;
    font-weight: 600;
}
.manual-subtab-btn:hover {
    border-color: #4f82b8;
    color: #ffffff;
    transform: translateY(-1px);
}
.manual-subtab-btn.active {
    background: linear-gradient(180deg, #1f5ea0 0%, #194f86 100%);
    border-color: #66b3ff;
    color: #ffffff;
    box-shadow: 0 0 0 1px rgba(113, 183, 255, 0.42) inset, 0 7px 18px rgba(8, 25, 46, 0.32);
}
.manual-subtab-btn.active .manual-subtab-desc,
.manual-subtab-btn.active .manual-subtab-kicker,
.manual-subtab-btn.active .manual-subtab-main {
    color: #ffffff;
}
.manual-subtab-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1;
    min-height: 0;
}
.manual-creator-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    height: 100%;
}
.manual-creator-queue {
    min-height: 220px;
    max-height: 360px;
}
.manual-creator-row {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #252525;
    border: 1px solid #363636;
    border-radius: 6px;
    padding: 8px;
    margin-bottom: 6px;
}
.manual-creator-name {
    flex: 1 1 auto;
    min-width: 180px;
    display: block;
    color: #f3f4f6;
    font-weight: 700;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.manual-creator-pct {
    width: 96px;
    min-width: 96px;
}
.manual-creator-output {
    height: 120px;
    min-height: 120px;
    font-family: 'Consolas', monospace;
}
.manual-creator-saved {
    height: 170px;
}
.manual-creator-empty {
    color: #9ca3af;
    font-size: 0.88rem;
    padding: 8px;
}
.manual-creator-save-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding: 8px;
    border-radius: 6px;
    border: 1px solid transparent;
    cursor: pointer;
}
.manual-creator-save-item:hover {
    background: #232323;
    border-color: #2f2f2f;
}
.manual-creator-save-item.active {
    background: #15345a;
    border-color: #245a99;
}
.manual-creator-save-name {
    flex: 1;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.manual-creator-save-meta {
    font-family: 'Consolas', monospace;
    font-size: 0.8rem;
    color: #9fb6d8;
}
.manual-creator-remaining-ok {
    color: #22c55e;
    font-family: monospace;
    font-weight: 800;
}
.manual-creator-remaining-warn {
    color: #f87171;
    font-family: monospace;
    font-weight: 800;
}


/* =========================================
   9.5 MODULE: G25 TIME MACHINE
   ========================================= */
#view-timemachine {
    width: 100%;
    min-height: 0;
}
.tm-shell {
    width: 100%;
    min-height: 0;
    height: 100%;
    display: grid;
    grid-template-columns: 350px minmax(0, 1fr);
    gap: 14px;
}
.tm-sidebar {
    background: linear-gradient(180deg, #0f2442 0%, #0a1730 100%);
    border: 1px solid #27466f;
    border-radius: 14px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 0;
}
.tm-brand {
    font-size: 1.06rem;
    font-weight: 900;
    letter-spacing: 0.03em;
    color: #d6ebff;
}
.tm-subtitle {
    font-size: 0.84rem;
    color: #9fc2e7;
    margin-bottom: 4px;
}
.tm-controls-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}
.tm-checks {
    padding-top: 6px;
    border-top: 1px solid rgba(130, 168, 210, 0.22);
}
.tm-main-panel {
    min-width: 0;
    min-height: 0;
    overflow: auto;
    background: linear-gradient(180deg, #e8f1ff 0%, #dbe9fb 100%);
    border: 1px solid #bfd3ef;
    border-radius: 14px;
    padding: 12px;
}
.tm-results {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.tm-export-card {
    background: linear-gradient(180deg, #f8fbff 0%, #eef5ff 100%);
    border: 1px solid #c9daf2;
    border-radius: 14px;
    padding: 14px;
    box-shadow: 0 14px 32px rgba(16, 36, 62, 0.16);
}
.tm-export-brand {
    text-align: center;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: rgba(30, 101, 171, 0.74);
    margin-bottom: 8px;
}
.tm-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
    margin-bottom: 10px;
}
.tm-title {
    font-size: 1.5rem;
    font-weight: 900;
    color: #0f3159;
    line-height: 1.05;
}
.tm-target {
    margin-top: 4px;
    font-size: 1.1rem;
    font-weight: 800;
    color: #1b4270;
    overflow-wrap: anywhere;
}
.tm-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-end;
    align-items: center;
}
.tm-meta span {
    background: #dceafe;
    border: 1px solid #bdd4f3;
    color: #1d4779;
    border-radius: 999px;
    padding: 4px 9px;
    font-size: 0.72rem;
    font-weight: 700;
}
.tm-strip {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    background: #e9f2ff;
    border: 1px solid #c4d7f2;
    border-radius: 10px;
    padding: 10px;
    margin-bottom: 10px;
}
.tm-strip-step {
    --tm-era-color: #5b8def;
    position: relative;
    min-width: 126px;
    background: #ffffff;
    border: 1px solid #d3e2f7;
    border-radius: 10px;
    padding: 8px 10px 8px 28px;
}
.tm-strip-dot {
    position: absolute;
    left: 10px;
    top: 14px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--tm-era-color);
    box-shadow: 0 0 0 3px rgba(91, 141, 239, 0.18);
}
.tm-strip-title {
    font-weight: 800;
    color: #1b3e69;
    font-size: 0.82rem;
}
.tm-strip-dist {
    font-family: 'Consolas', monospace;
    font-size: 0.78rem;
    color: #275280;
    margin-top: 2px;
}
.tm-strip-link {
    position: absolute;
    right: -14px;
    top: 50%;
    width: 10px;
    height: 2px;
    background: #b6cdee;
}
.tm-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.tm-panel {
    background: #ffffff;
    border: 1px solid #cfdef3;
    border-radius: 12px;
    padding: 10px;
    min-width: 0;
}
.tm-panel-title {
    font-size: 0.9rem;
    font-weight: 900;
    letter-spacing: 0.02em;
    color: #1b4d84;
    margin-bottom: 8px;
}
.tm-era-note {
    margin: -2px 0 8px;
    font-size: 0.78rem;
    color: #486b93;
    line-height: 1.35;
}
.tm-main-ancestry-panel {
    margin-top: 2px;
}
.tm-main-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-bottom: 8px;
}
.tm-main-meta span {
    background: #e4efff;
    border: 1px solid #c7daf6;
    color: #1f4d82;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 0.74rem;
    font-weight: 700;
}
.tm-main-total {
    font-size: 0.88rem;
    font-weight: 900;
    color: #133f70;
    margin-bottom: 8px;
}
.tm-main-groups {
    display: grid;
    gap: 10px;
}
.tm-main-group {
    border: 1px solid #d5e3f5;
    border-radius: 10px;
    background: #f8fbff;
    overflow: hidden;
}
.tm-main-group-head {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: center;
    padding: 8px 10px;
    background: #dfeeff;
    border-bottom: 1px solid #c6daf4;
    font-size: 0.82rem;
    font-weight: 900;
    color: #164777;
}
.tm-main-group-items {
    padding: 8px 10px;
    display: grid;
    gap: 8px;
}
.tm-main-item {
    border: 1px solid #dfe9f7;
    border-radius: 8px;
    background: #ffffff;
    padding: 7px 9px;
}
.tm-main-item-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
}
.tm-main-name {
    font-size: 0.8rem;
    font-weight: 700;
    color: #183f68;
    line-height: 1.22;
    overflow-wrap: anywhere;
    word-break: break-word;
    flex: 1;
}
.tm-main-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 7px;
    vertical-align: middle;
}
.tm-main-pct {
    font-family: 'Consolas', monospace;
    font-size: 0.78rem;
    color: #1f4d82;
    font-weight: 800;
    white-space: nowrap;
}
.tm-main-bar {
    margin-top: 6px;
    height: 5px;
    border-radius: 999px;
    background: #e4edf9;
    overflow: hidden;
}
.tm-main-bar span {
    display: block;
    height: 100%;
    border-radius: 999px;
}
.tm-main-empty {
    font-size: 0.78rem;
    color: #53769e;
}
.tm-panel-note {
    margin: -2px 0 8px;
    font-size: 0.75rem;
    color: #486b93;
    line-height: 1.35;
}
.tm-era-list {
    display: grid;
    gap: 8px;
    max-height: 500px;
    overflow: auto;
    padding-right: 2px;
}
.tm-era-card {
    --tm-era-color: #5b8def;
    border: 1px solid #d2e0f5;
    border-radius: 10px;
    padding: 10px;
    background: #f8fbff;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.8);
}
.tm-era-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.tm-era-label {
    font-size: 0.88rem;
    font-weight: 900;
    color: #173f6c;
}
.tm-era-dot {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: var(--tm-era-color);
}
.tm-era-metrics {
    margin-top: 6px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 0.75rem;
    color: #2b527f;
}
.tm-conf-badge {
    border-radius: 999px;
    padding: 2px 8px;
    border: 1px solid transparent;
    font-weight: 800;
}
.tm-badge-high { background: #d8f8ea; color: #166534; border-color: #86efac; }
.tm-badge-mid { background: #e0efff; color: #1d4ed8; border-color: #93c5fd; }
.tm-badge-low { background: #fff1df; color: #b45309; border-color: #fdba74; }
.tm-badge-off { background: #eef2f7; color: #64748b; border-color: #cbd5e1; }
.tm-era-stability {
    margin-top: 5px;
    font-size: 0.74rem;
    color: #3a5f88;
}
.tm-era-comp-list {
    margin-top: 8px;
    display: grid;
    gap: 4px;
}
.tm-era-more {
    margin-top: 3px;
    font-size: 0.72rem;
    color: #4d7098;
    font-weight: 700;
}
.tm-era-comp {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 6px;
    align-items: center;
}
.tm-era-comp-name {
    font-size: 0.76rem;
    font-weight: 700;
    color: #1a3d66;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.tm-era-comp-pct {
    font-family: 'Consolas', monospace;
    font-size: 0.75rem;
    color: #1f4f81;
    font-weight: 700;
}
.tm-era-comp-bar {
    grid-column: 1 / -1;
    height: 6px;
    border-radius: 999px;
    background: #e2ebf9;
    overflow: hidden;
}
.tm-era-comp-bar span {
    display: block;
    height: 100%;
    border-radius: 999px;
}
.tm-drift-wrap {
    border: 1px solid #d3e1f5;
    border-radius: 10px;
    background: linear-gradient(180deg, #fcfeff 0%, #f4f9ff 100%);
    overflow: hidden;
}
.tm-drift-svg {
    width: 100%;
    height: auto;
    display: block;
}
.tm-drift-grid { stroke: rgba(73, 117, 171, 0.14); stroke-width: 1; }
.tm-drift-axis { stroke: #88aede; stroke-width: 1.6; }
.tm-drift-path { fill: none; stroke: #2f67ad; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.tm-drift-node { stroke: #ffffff; stroke-width: 2; }
.tm-drift-label {
    font-size: 10px;
    font-weight: 700;
    fill: #1f4b7d;
}
.tm-drift-axis-label {
    font-size: 11px;
    font-weight: 700;
    fill: #2f5f93;
}
.tm-matrix-panel {
    margin-top: 10px;
}
.tm-matrix-wrap {
    max-height: 360px;
    overflow: auto;
    border: 1px solid #d2e2f6;
    border-radius: 10px;
}
.tm-matrix {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: fixed;
}
.tm-matrix thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #deecff;
    color: #174a7a;
    border-bottom: 1px solid #bfd4f0;
    padding: 7px 8px;
    font-size: 0.75rem;
    font-weight: 800;
    text-align: center;
}
.tm-matrix thead th:first-child {
    text-align: left;
    left: 0;
    z-index: 3;
}
.tm-matrix tbody td {
    border-bottom: 1px solid #ebf1fa;
    padding: 7px 8px;
    text-align: center;
    font-family: 'Consolas', monospace;
    font-size: 0.74rem;
    color: #244b79;
}
.tm-matrix-name {
    text-align: left !important;
    font-family: 'Segoe UI', Arial, sans-serif !important;
    font-weight: 700;
    color: #1a3d66 !important;
    background: #f8fbff;
    position: sticky;
    left: 0;
    z-index: 1;
}
.tm-zero {
    background: #f8fbff !important;
    color: #a6b9d0;
}
.tm-zero-note {
    text-align: center;
    color: #587ca6;
    font-weight: 700;
    background: #f8fbff;
}

/* =========================================
   10. MODULE: AUTO EDIT & REVERSER & OUTPUTS
   ========================================= */
.footer-actions {
    display: flex; justify-content: space-between; align-items: center;
    margin-top: auto; padding-top: 15px; border-top: 1px solid #333;
}
.radio-group { display: flex; gap: 20px; }
.radio-group label { display: flex; align-items: center; gap: 5px; cursor: pointer; }

.output-line {
    background-color: #000; border: 1px solid #444;
    color: var(--accent-green) !important;
    font-family: 'Consolas', monospace; margin-top: 10px;
}

/* Auto Edit Results */
#autoResultsList {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 320px;
    overflow-y: auto;
}
.auto-result {
    display: flex;
    align-items: center;
    gap: 10px;
    background-color: var(--panel-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 8px 10px;
}
.auto-result:hover { background-color: #252525; }
.auto-result input { margin: 0; }
.auto-name { flex: 1; font-weight: 600; }
.auto-pct { font-family: 'Consolas', monospace; font-weight: 700; color: var(--accent-green); }

/* Reverser Grid */
.results-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 20px;
    flex-grow: 1; min-height: 250px; margin-top: 20px;
}
.result-column { display: flex; flex-direction: column; height: 100%; }
.col-content {
    background-color: var(--panel-color);
    border: 1px solid var(--border-color);
    flex-grow: 1; padding: 10px; overflow-y: auto;
    font-family: 'Consolas', monospace;
}
.purple-accent { border-color: var(--accent-purple); color: #d8b4fe; }


.rev-model-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 10px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: rgba(14, 30, 56, 0.45);
    margin-bottom: 8px;
}
.rev-model-row.active {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 1px rgba(59,130,246,0.3) inset;
    background: rgba(17, 46, 89, 0.6);
}
.rev-model-main {
    min-width: 0;
    flex: 1;
}
.rev-model-title {
    font-weight: 700;
    color: #eaf2ff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.rev-model-metrics {
    margin-top: 2px;
    font-size: 0.78rem;
    color: #9db2d1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#view-reverser .result-column {
    height: auto;
}

#revFinalContent.col-content {
    flex-grow: 0;
    overflow: visible;
    background: transparent;
    border: none;
    padding: 0;
    font-family: inherit;
}

.rev-model-card .single-map-sidebar {
    max-height: none;
}
.rev-model-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}
#revFinalContent .single-map-row-deletable {
    cursor: default;
}
#revFinalContent.rev-delete-mode-active .single-map-row-deletable {
    cursor: pointer;
    transition: background-color 0.14s ease, transform 0.14s ease;
}
#revFinalContent.rev-delete-mode-active .single-map-row-deletable:hover {
    background: rgba(236, 72, 153, 0.12);
    transform: translateX(2px);
}
#revFinalContent .single-map-row.rev-source-blocked {
    opacity: 0.34;
    text-decoration: line-through;
}

.rev-model-actions-inline {
    margin-top: 6px;
    margin-bottom: 6px;
    display: flex;
    justify-content: flex-start;
}
.rev-model-sources-list {
    margin-top: 4px;
    border: 1px solid #2f4c71;
    border-radius: 6px;
    background: rgba(9, 22, 44, 0.55);
    padding: 6px;
    max-height: none;
    overflow: visible;
}

#revModelsList.col-content {
    flex-grow: 0;
    height: auto;
    max-height: none;
    overflow: visible;
}
.rev-model-source-line-full {
    font-family: 'Consolas', monospace;
    font-size: 0.70rem;
    color: #c4d7f1;
    line-height: 1.32;
    padding: 3px 0;
    border-bottom: 1px dashed rgba(142, 195, 255, 0.18);
    white-space: normal;
    word-break: break-word;
}
.rev-model-source-line-full:last-child {
    border-bottom: none;
}

.rev-history {
    margin-top: 10px;
}

.rev-history-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    cursor: pointer;
}

.rev-history-head-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.rev-history-toggle {
    min-width: 110px;
}

.rev-history-clear {
    min-width: 96px;
}

.rev-history-body {
    margin-top: 0;
}

.rev-history.collapsed .rev-history-body {
    display: none;
}

#revHistoryCount {
    margin-left: 6px;
    font-weight: 700;
    color: #cde2ff;
}

#revHistoryList.col-content {
    flex-grow: 0;
    max-height: 180px;
    overflow-y: auto;
}

.rev-history-item {
    width: 100%;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border: 1px solid #2e4c74;
    border-radius: 8px;
    background: rgba(9, 22, 44, 0.55);
    color: #e7f1ff;
    cursor: pointer;
    margin-bottom: 8px;
    text-align: left;
}

.rev-history-item:hover {
    border-color: #4f78ad;
    background: rgba(16, 39, 71, 0.72);
}

.rev-history-item.active {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 1px rgba(59,130,246,0.28) inset;
}

.rev-history-time {
    font-family: 'Consolas', monospace;
    font-size: 0.78rem;
    color: #a8bfdf;
}

.rev-history-target {
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 700;
    color: #eaf2ff;
}

.rev-history-meta {
    font-family: 'Consolas', monospace;
    font-size: 0.78rem;
    color: #7eb9ff;
}

.rev-history-empty {
    font-size: 0.82rem;
    color: #9fb5d4;
    padding: 8px 4px;
}

/* Progress Bars */
.progress-container {
    width: 100%; height: 6px; background-color: #333;
    border-radius: 3px; overflow: hidden; margin-top: 10px;
}
.progress-bar { height: 100%; width: 0%; background-color: var(--accent-blue); transition: width 0.3s; }
.status-text { text-align: left; font-size: 0.8rem; color: var(--text-muted); margin-top: 4px; }
.center { text-align: center; }
.placeholder-text { color: #555; font-style: italic; text-align: center; padding-top: 20px; }

/* =========================================
   11. MODULE: HEATMAP
   ========================================= */

#hmContainer {
    box-shadow: 0 0 30px rgba(0,0,0,0.8);
    background-color: #000;
    /* Garante que o tooltip fique posicionado relativo a este container */
    position: relative;
}

#hmCanvas {
    display: block;
    image-rendering: pixelated; /* Importante para nitidez dos quadrados */
    cursor: crosshair;
}

.hm-tooltip {
    position: absolute; /* Mudado de fixed para absolute para seguir o scroll */
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid var(--accent-blue);
    color: #e2e8f0;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-family: 'Consolas', monospace;
    pointer-events: none;
    display: none;
    z-index: 100;
    white-space: pre;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
    line-height: 1.5;
}

/* =========================================
   11. GEO MAP STYLES (CORRIGIDO)
   ========================================= */
/* Garante que o mapa ocupe o espaço */
#view-heatmap {
    height: 100vh; /* Força altura total da tela */
    display: flex;
    overflow: hidden;
}

#map-wrapper {
    width: 100%;
    height: 100%;
    background-color: #e5e5e5; /* Fundo cinza para saber se o container existe */
}

#map {
    width: 100%;
    height: 100%;
}

/* Estilos dos Marcadores */
.map-label {
    font-size: 10px;
    font-weight: bold;
    color: #333;
    text-shadow: 0 0 2px white;
    white-space: nowrap;
}
.map-label-bg {
    background: rgba(255, 255, 255, 0.6);
    padding: 1px 3px;
    border-radius: 3px;
}
/* =========================================
   HEATMAP V2 STYLES (ADDED)
   ========================================= */
.hmv2-scope {
    --hmv2-bg: #ffffff; --hmv2-panel: #f8f9fa; --hmv2-text: #212529;
    --hmv2-accent: #d32f2f; --hmv2-accent-hover: #b71c1c; --hmv2-border: #dee2e6;
    --hmv2-list-bg: #1e1e1e; --hmv2-list-text: #e0e0e0;
    font-family: 'Inter', sans-serif; background-color: var(--hmv2-bg); color: var(--hmv2-text); padding: 0; height: 100%; min-height: 0;
}
.hmv2-scope header.hmv2-header {
    height: 55px; background: #fff; border-bottom: 1px solid var(--hmv2-border);
    display: flex; align-items: center; padding: 0 25px; justify-content: space-between; z-index: 2000;
}
.hmv2-scope h1 { font-size: 1.2rem; margin: 0; font-weight: 800; color: #000; letter-spacing: -0.5px; }
.hmv2-badge { background: #d50000; color: white; padding: 2px 6px; border-radius: 4px; font-size: 0.65rem; margin-left: 8px; font-weight: 600; }
#hmv2_container { display: flex; flex: 1; height: calc(100% - 55px); position: relative; min-height: 0; }
#hmv2_sidebar {
    width: 400px; background-color: var(--hmv2-panel); border-right: 1px solid var(--hmv2-border);
    padding: 20px; display: flex; flex-direction: column; gap: 15px; overflow-y: auto; z-index: 1000;
}
.hmv2-scope label { font-size: 0.7rem; font-weight: 700; color: #6c757d; margin-bottom: 5px; display: block; text-transform: uppercase; }
.hmv2-scope textarea {
    width: 100%; height: 100px; background: #fff; border: 2px solid #e0e0e0; color: #495057; padding: 12px;
    font-family: 'JetBrains Mono', monospace; font-size: 0.7rem; resize: vertical; border-radius: 6px;
}
.hmv2-scope textarea:focus { outline: none; border-color: var(--hmv2-accent); }
.hmv2-setting-box { background: #fff; padding: 12px; border-radius: 8px; border: 1px solid var(--hmv2-border); }
.hmv2-scope input[type="range"] { width: 100%; accent-color: var(--hmv2-accent); margin: 10px 0; height: 4px; cursor: pointer; }
.val-display { float: right; font-family: 'JetBrains Mono'; font-weight: bold; color: var(--hmv2-accent); font-size: 0.8rem; }
.hmv2-scope button {
    width: 100%; padding: 14px; background: var(--hmv2-accent); color: white; border: none; border-radius: 6px;
    font-weight: 700; font-size: 0.85rem; cursor: pointer; margin-top: 5px;
}
.hmv2-scope button:hover { background: var(--hmv2-accent-hover); }
.hmv2-btn-row { display: flex; gap: 10px; margin-top: 5px; }
.hmv2-mode-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 6px; }
.hmv2-mode-tab { margin-top: 0 !important; padding: 10px !important; font-size: 0.72rem !important; background: #fff !important; color: #495057 !important; border: 2px solid #dee2e6 !important; }
.hmv2-mode-tab.active { background: #1f6aa5 !important; border-color: #1f6aa5 !important; color: #fff !important; }
.hmv2-mode-panel { display: flex; flex-direction: column; gap: 12px; }
.hmv2-target-search { width: 100%; background: #fff; border: 2px solid #e0e0e0; color: #495057; padding: 8px 10px; font-family: "Inter", sans-serif; font-size: 0.78rem; border-radius: 6px; margin-bottom: 8px; }
.hmv2-target-search:focus { outline: none; border-color: var(--hmv2-accent); }
.hmv2-target-list { max-height: 170px; background: #fff; border: 1px solid #dfe3e8; border-radius: 6px; overflow-y: auto; padding: 4px; }
.hmv2-target-list .checkbox-item { background: #f7f9fb; color: #1f2937; border: 1px solid #e3e8ef; margin-bottom: 4px; }
.hmv2-target-list .checkbox-item:hover { background: #eaf3ff; }
.hmv2-target-list .checkbox-item.selected { color: #fff; border-color: #1f6aa5; }
.hmv2-inline-note { font-size: 0.72rem; color: #526173; margin-bottom: 8px; line-height: 1.35; }
.hmv2-inline-check { font-size: 0.78rem !important; color: #1f2937 !important; text-transform: none !important; display: flex !important; align-items: center; gap: 8px; margin: 0 !important; }
.hmv2-inline-check input { width: auto; accent-color: var(--hmv2-accent); }
.hmv2-btn-toggle { background: #fff !important; color: #495057 !important; border: 2px solid #dee2e6 !important; }
.hmv2-btn-toggle.active { background: #212529 !important; color: #fff !important; border-color: #212529 !important; }
.hmv2-btn-save { background: #2e7d32 !important; }
#hmv2_distPanel { background-color: var(--hmv2-list-bg); border-radius: 8px; padding: 15px; margin-top: 10px; border: 1px solid #333; }
.top10-item { font-family: 'JetBrains Mono', monospace; font-size: 0.75rem; color: var(--hmv2-list-text); margin-bottom: 4px; display: flex; justify-content: space-between; }
.top10-rank { color: var(--hmv2-accent); font-weight: bold; margin-right: 8px; }
.top10-dist { color: #81c784; }
#hmv2_map-wrapper { flex: 1; position: relative; overflow: hidden; }
#hmv2_map { width: 100%; height: 100%; background: #fff; z-index: 1; }
#hmv2_distOverlay {
    position: absolute; top: 20px; right: 20px; background: rgba(0, 0, 0, 0.7);
    color: white; padding: 10px 15px; border-radius: 6px; z-index: 5000; pointer-events: none;
}
.map-label {
    background: transparent !important; border: none !important; color: #ffffff;
    font-weight: 700 !important; font-family: 'Inter', sans-serif; font-size: 11px;
    text-shadow: -1px -1px 0 #000, 1px -1px 0 #000 !important; pointer-events: none;
}
.map-label-bg { background: rgba(0, 0, 0, 0.65) !important; border-radius: 4px; padding: 2px 6px; }
#view-heatmapv2 .leaflet-marker-icon.map-label,
#view-heatmapv2 .leaflet-marker-icon.map-label.map-label-bg {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    pointer-events: none;
    padding: 0 !important;
    border-radius: 0 !important;
}

#view-heatmapv2 .map-label span {
    display: inline-block;
    color: #0b3557;
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.012em;
    line-height: 1.16;
    white-space: nowrap;
    text-shadow:
        0 0 1px rgba(255, 255, 255, 0.95),
        0 1px 2px rgba(255, 255, 255, 0.92),
        0 0 4px rgba(255, 255, 255, 0.85);
    padding: 1px 2px;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

#view-heatmapv2 .map-label.map-label-bg span {
    padding: 1px 2px;
    border-radius: 0;
    border: none;
    background: transparent !important;
    box-shadow: none !important;
}
#hmv2_loader {
    position: absolute; inset: 0; background: rgba(255,255,255,0.98);
    z-index: 9999; display: none; justify-content: center; align-items: center; flex-direction: column;
}
.hmv2-spinner {
    width: 50px; height: 50px; border: 4px solid #f3f3f3;
    border-top-color: var(--hmv2-accent); border-radius: 50%;
    animation: spin 0.8s linear infinite; margin-bottom: 20px;
}
@keyframes spin { to { transform: rotate(360deg); } }

#hmv2_map-wrapper {
    display: block;
    height: 100%;
    width: 100%;
    position: relative;
    background: #fff;
}

#hmv2_map {
    height: 100%;
    width: 100%;
    z-index: 1;
}

.leaflet-pane { z-index: 400 !important; } /* Ensures map layers are on top */

/* =========================================
   12. NEW UI HELPERS (Desktop Parity)
   ========================================= */
.results-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 8px 0 12px;
    flex-wrap: wrap;
}
.results-toolbar input {
    max-width: 220px;
}
.status-text.small {
    font-size: 0.75rem;
}
.result-highlight {
    border: 2px solid var(--accent-blue);
    border-radius: 6px;
}

.pc-subtitle {
    color: var(--text-muted);
    font-family: 'Consolas', monospace;
    font-size: 0.85rem;
    margin-bottom: 6px;
}
.pc-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    font-size: 0.9rem;
}
.pc-row-right {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: 'Consolas', monospace;
    color: var(--text-muted);
}
.pc-bar-track {
    width: 120px;
    height: 8px;
    background-color: #333;
    border-radius: 4px;
    overflow: hidden;
}
.pc-bar-fill {
    height: 100%;
    background-color: var(--accent-orange);
    border-radius: 4px;
}

.pca-layout {
    display: flex;
    gap: 15px;
    height: 100%;
    min-width: 0;
}
.pca-panel.left {
    width: 320px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    min-width: 0;
}
.pca-panel.center {
    flex-grow: 1;
    min-width: 300px;
}
.pca-panel.right {
    width: 220px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    min-width: 0;
}

/* =========================================
   12. MODULE: CONVERTER TOOLS (WEB)
   ========================================= */
.tool-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

.tool-panel {
    background-color: var(--panel-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.panel-title {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    font-weight: bold;
    margin-bottom: 6px;
}

.panel-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: auto;
}

.converter-status {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.status-pill {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    background: #333;
    color: var(--text-muted);
}

.status-pill.ok {
    background: rgba(34, 197, 94, 0.15);
    color: var(--accent-green);
    border: 1px solid var(--accent-green);
}

.status-pill.bad {
    background: rgba(220, 38, 38, 0.15);
    color: var(--accent-red);
    border: 1px solid var(--accent-red);
}

.tab-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.tab-btn {
    background: #222;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: 700;
}

.tab-btn.active {
    background: var(--accent-blue);
    color: #fff;
    border-color: var(--accent-blue);
}

.gene-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 8px;
    max-height: 280px;
    overflow-y: auto;
    padding: 8px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    background: #232323;
}

.gene-item {
    background: #262626;
    border: 1px solid #333;
    border-radius: 4px;
    padding: 6px;
    text-align: center;
    cursor: pointer;
    font-size: 0.75rem;
}

.gene-item span {
    display: block;
}

.gene-item .gene-name {
    font-weight: 700;
    color: #fff;
}

.gene-item .gene-desc {
    font-size: 0.65rem;
    color: var(--text-muted);
}

.gene-item.selected {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
    color: #fff;
}

.mini-help {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.selected-box {
    min-height: 200px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 10px;
    background: #1f1f1f;
    font-size: 0.85rem;
    color: var(--text-main);
    line-height: 1.4;
    white-space: pre-wrap;
}

.loader {
    width: 26px;
    height: 26px;
    border: 3px solid #333;
    border-top-color: var(--accent-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    display: none;
    margin: 8px auto;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.status-msg {
    display: none;
    padding: 10px;
    border-radius: 4px;
    font-size: 0.85rem;
}

.status-success {
    background: rgba(34, 197, 94, 0.15);
    color: var(--accent-green);
    border: 1px solid var(--accent-green);
}

.status-warn {
    background: rgba(245, 158, 11, 0.15);
    color: var(--accent-orange);
    border: 1px solid var(--accent-orange);
}

.status-error {
    background: rgba(220, 38, 38, 0.15);
    color: var(--accent-red);
    border: 1px solid var(--accent-red);
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.stat-card {
    background: #222;
    border: 1px solid #333;
    border-radius: 4px;
    padding: 12px;
    text-align: center;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 6px;
}

.stat-value {
    font-size: 1.2rem;
    font-weight: bold;
    color: #fff;
}

.progress-block {
    margin-top: 10px;
}

.progress-track {
    height: 8px;
    background: #1c1c1c;
    border-radius: 999px;
    overflow: hidden;
    border: 1px solid #333;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: var(--accent-blue);
    transition: width 0.4s ease;
}

.report-box {
    background: #1c1c1c;
    border: 1px solid #333;
    border-radius: 4px;
    padding: 12px;
    font-family: 'Consolas', monospace;
    font-size: 0.85rem;
    white-space: pre-wrap;
}

.table-scroll {
    max-height: 280px;
    overflow-y: auto;
}

.tool-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.tool-table th,
.tool-table td {
    padding: 8px;
    border-bottom: 1px solid #333;
    text-align: left;
}

.tool-table th {
    text-transform: uppercase;
    font-size: 0.7rem;
    color: var(--text-muted);
}

.file-list {
    min-height: 160px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 10px;
    background: #1f1f1f;
    font-size: 0.85rem;
    color: var(--text-main);
    line-height: 1.4;
}

@media (max-width: 1100px) {
    .tool-grid {
        grid-template-columns: 1fr;
    }
    .stat-grid {
        grid-template-columns: 1fr;
    }
}


/* Single Result Screenshot */
.single-result-snapshot {
    position: fixed;
    left: -10000px;
    top: 0;
    width: 760px;
    background: #f5f7fb;
    padding: 18px;
    z-index: 9999;
}

.single-snap-brand {
    width: 100%;
    text-align: center;
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: 0.32em;
    color: #1f6aa5;
    opacity: 0.7;
    margin-bottom: 12px;
}


.single-snap-card {
    background: #ffffff;
    border-radius: 16px;
    border: 1px solid #e6e8ef;
    padding: 22px 26px 24px;
    box-shadow: 0 18px 50px rgba(15, 23, 42, 0.12);
    font-family: 'Inter', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

.single-snap-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e6e8ef;
    margin-bottom: 16px;
}

.single-snap-title {
    font-size: 1.45rem;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.1;
}

.single-snap-distance {
    justify-self: end;
    width: max-content;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: 'JetBrains Mono', 'Consolas', monospace;
    font-size: 0.95rem;
    font-weight: 700;
    color: #2563eb;
    background: #eef2ff;
    border-radius: 999px;
    padding: 4px 12px;
    text-align: center;
    line-height: 1;
    white-space: nowrap;
}

.single-snap-group {
    margin-bottom: 14px;
}

.single-snap-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    font-weight: 700;
    color: #1d4ed8;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    margin-bottom: 8px;
}

.single-snap-group-total {
    color: #1d4ed8;
}

.single-snap-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 140px 90px;
    align-items: center;
    column-gap: 12px;
    padding: 6px 0;
    border-bottom: 1px dashed #e2e8f0;
    font-size: 0.95rem;
}

.single-snap-row:last-child {
    border-bottom: none;
}

.single-snap-bar-track {
    height: 6px;
    background: #e2e8f0;
    border-radius: 999px;
    overflow: hidden;
}

.single-snap-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #14b8a6, #22c55e);
    border-radius: 999px;
}

.single-snap-name {
    color: #111827;
    font-weight: 600;
}

.single-snap-pct {
    text-align: right;
    font-family: 'JetBrains Mono', 'Consolas', monospace;
    font-weight: 700;
    color: #0f766e;
}


.perpc-agg-row {
    margin-top: 8px;
    padding: 8px 10px;
    background: #1f1f1f;
    border: 1px solid #2f2f2f;
    border-radius: 6px;
    color: var(--text-main);
}
.perpc-agg-row label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    font-weight: 700;
}
.perpc-agg-row input {
    width: auto;
}


/* =========================================
   MATCHES TAB (EMBED)
   ========================================= */
#view-matches {
    gap: 0;
}
.matches-frame-wrap {
    flex: 1;
    min-height: 0;
    display: flex;
}
.matches-frame {
    flex: 1;
    width: 100%;
    height: 100%;
    min-height: 700px;
    border: 0;
    border-radius: 10px;
    background: #0f172a;
}



/* =========================================
   MATCHES UI (INTEGRATED)
   ========================================= */
.hidden { display: none !important; }

.matches-root {
    gap: 20px;
    min-height: calc(100vh - 140px);
}


.matches-recommended {
    font-size: 0.8rem;
    color: #4ade80;
    font-weight: 700;
    margin-bottom: 10px;
}

.matches-settings-toggle {
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.matches-settings-footer {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.matches-settings-panel {
    display: none;
    padding: 10px 0 0;
}

.matches-settings-panel.open {
    display: block;
}
.matches-block {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
}


.matches-file-input {
    width: 100%;
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: #151515;
    color: #cbd5f5;
    font-size: 0.8rem;
}

.matches-file-input::file-selector-button {
    background-color: var(--accent-blue);
    color: #ffffff;
    border: none;
    border-radius: 6px;
    padding: 6px 12px;
    margin-right: 12px;
    font-weight: 700;
    cursor: pointer;
}

.matches-file-input::-webkit-file-upload-button {
    background-color: var(--accent-blue);
    color: #ffffff;
    border: none;
    border-radius: 6px;
    padding: 6px 12px;
    margin-right: 12px;
    font-weight: 700;
    cursor: pointer;
}

.matches-file-input:hover::file-selector-button {
    background-color: var(--accent-blue-hover);
}

.matches-file-input:hover::-webkit-file-upload-button {
    background-color: var(--accent-blue-hover);
}

.matches-label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.matches-file-name {
    font-size: 0.8rem;
    color: #cbd5f5;
    margin-top: 6px;
    word-break: break-word;
}

.matches-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.matches-slider-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.matches-slider-row input[type='range'] {
    flex: 1;
    accent-color: var(--accent-blue);
}

.matches-slider-value {
    min-width: 54px;
    text-align: center;
    padding: 6px 8px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: #1f1f1f;
    color: #e2e8f0;
    font-weight: 600;
    font-size: 0.8rem;
}

.matches-toggles {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 10px 0 16px;
}

.matches-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-main);
}

.matches-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.matches-main {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.matches-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.matches-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: #e2e8f0;
}

.matches-sub {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.matches-run-title {
    margin-top: 4px;
    font-size: 0.92rem;
    font-weight: 700;
    color: #8bd2ff;
    letter-spacing: 0.2px;
}

.matches-share-pct {
    font-size: 0.80rem;
    font-weight: 700;
    color: #93c5fd;
    margin-left: 6px;
}

.matches-stats {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: #1f1f1f;
}

.matches-stat {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.matches-stat span {
    margin-left: 6px;
    color: #fff;
    font-weight: 700;
}

.matches-export {
    margin-left: auto;
    display: flex;
    gap: 8px;
}

.matches-loading {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    background: #1c1c1c;
}

.matches-empty {
    border: 1px dashed var(--border-color);
    border-radius: 8px;
    padding: 16px;
    color: var(--text-muted);
    background: #1c1c1c;
}

.matches-table-wrap {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: auto;
}

.matches-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.matches-table thead {
    background: #222;
    color: #d1d5db;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.04em;
}

.matches-table th,
.matches-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-color);
    text-align: left;
}

.matches-table tbody tr:hover {
    background: #202020;
}

.matches-painter {
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: linear-gradient(180deg, #171c28 0%, #111622 100%);
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.matches-painter-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
}

.matches-painter-title {
    font-size: 1rem;
    font-weight: 800;
    color: #dbeafe;
    letter-spacing: 0.2px;
}

.matches-painter-sub {
    margin-top: 4px;
    font-size: 0.78rem;
    color: #9ca3af;
    max-width: 760px;
}

.matches-painter-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.matches-painter-controls > label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.75rem;
    color: #94a3b8;
}

.matches-painter-controls select {
    min-width: 220px;
    background: #0f172a;
    border: 1px solid #334155;
    color: #e2e8f0;
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 0.82rem;
}

.matches-painter-check {
    display: flex !important;
    flex-direction: row !important;
    align-items: center;
    gap: 8px !important;
    padding-top: 20px;
    font-size: 0.78rem !important;
    color: #cbd5e1 !important;
}

.matches-painter-grid {
    display: grid;
    grid-template-columns: minmax(460px, 1.2fr) minmax(280px, 0.8fr);
    gap: 12px;
}

.matches-painter-map-wrap,
.matches-painter-summary,
.matches-painter-crossref-box {
    border: 1px solid #2d3a50;
    border-radius: 10px;
    background: #0d1423;
}

.matches-painter-map-wrap {
    padding: 10px 10px 8px;
}

.matches-painter-map {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.matches-painter-row {
    display: grid;
    grid-template-columns: 26px 1fr;
    align-items: center;
    gap: 8px;
}

.matches-painter-chr {
    text-align: right;
    font-size: 0.76rem;
    font-weight: 800;
    color: #93c5fd;
}

.matches-painter-track {
    position: relative;
    border-radius: 7px;
    background: #1e293b;
    border: 1px solid #334155;
    min-height: 18px;
    overflow: hidden;
}

.matches-painter-seg {
    position: absolute;
    border-radius: 4px;
    min-width: 2px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.55) inset;
}

.matches-painter-empty-row {
    width: 100%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, rgba(71, 85, 105, 0.25), rgba(71, 85, 105, 0.08));
}

.matches-painter-side {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.matches-painter-summary {
    padding: 10px;
}

.matches-painter-summary-title {
    font-size: 0.84rem;
    font-weight: 800;
    color: #dbeafe;
    margin-bottom: 8px;
}

.matches-painter-summary-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 330px;
    overflow: auto;
    padding-right: 2px;
}

.matches-painter-summary-item {
    border: 1px solid #334155;
    border-radius: 9px;
    background: #111a2b;
    padding: 8px 10px;
}

.matches-painter-summary-item-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.matches-painter-summary-kit {
    display: flex;
    align-items: center;
    gap: 7px;
    min-width: 0;
}

.matches-painter-dot {
    width: 9px;
    height: 9px;
    border-radius: 999px;
    flex: 0 0 auto;
}

.matches-painter-kit-name {
    font-size: 0.80rem;
    font-weight: 700;
    color: #e2e8f0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.matches-painter-kit-metrics {
    font-family: "JetBrains Mono", monospace;
    font-size: 0.73rem;
    color: #93c5fd;
    white-space: nowrap;
}

.matches-painter-summary-meta {
    margin-top: 6px;
    font-size: 0.72rem;
    color: #94a3b8;
}

.matches-painter-crossref-box {
    padding: 10px;
}

.matches-painter-crossref-title {
    font-size: 0.84rem;
    font-weight: 800;
    color: #dbeafe;
    margin-bottom: 8px;
}

.matches-painter-crossref {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 360px;
    overflow: auto;
    padding-right: 2px;
}

.matches-painter-crossref-item {
    border: 1px solid #334155;
    border-radius: 9px;
    background: #111a2b;
    padding: 8px 10px;
}

.matches-painter-crossref-kit {
    font-size: 0.76rem;
    font-weight: 800;
    color: #93c5fd;
    margin-bottom: 6px;
}

.matches-painter-crossref-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 0.74rem;
    color: #d1d5db;
    border-top: 1px dashed #334155;
    padding-top: 5px;
    margin-top: 5px;
}

.matches-painter-crossref-row:first-child {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

.matches-painter-empty {
    border: 1px dashed #334155;
    border-radius: 8px;
    background: #111827;
    color: #94a3b8;
    font-size: 0.78rem;
    padding: 10px;
}

.matches-painter-crossref-warning {
    margin-top: 8px;
    margin-bottom: 8px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #f8fbff;
    color: #34577f;
    font-size: 0.74rem;
    line-height: 1.35;
    padding: 8px 10px;
}

.matches-painter-tooltip {
    position: fixed;
    z-index: 6000;
    max-width: 360px;
    background: rgba(12, 21, 37, 0.97);
    border: 1px solid #355070;
    border-radius: 10px;
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.45);
    padding: 8px 10px;
    pointer-events: none;
}

.matches-painter-tooltip-line {
    color: #deebff;
    font-size: 0.78rem;
    line-height: 1.28;
    margin-top: 3px;
}

.matches-painter-tooltip-line:first-child {
    margin-top: 0;
    color: #93c5fd;
    font-weight: 800;
}

.matches-painter-seg-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 6900;
    background: rgba(6, 14, 26, 0.22);
    backdrop-filter: blur(1.8px);
}

.matches-painter-seg-modal-card {
    position: fixed;
    left: -9999px;
    top: -9999px;
    min-width: 280px;
    width: min(420px, calc(100vw - 24px));
    border: 1px solid #b8cde9;
    border-radius: 12px;
    background: linear-gradient(180deg, #f8fbff 0%, #e9f2ff 100%);
    box-shadow: 0 20px 44px rgba(4, 21, 46, 0.36);
    color: #173a66;
    overflow: hidden;
}

.matches-painter-seg-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 12px;
    border-bottom: 1px solid #cbdbf0;
    background: linear-gradient(90deg, #2f7ad0 0%, #4f95e2 100%);
}

.matches-painter-seg-modal-title {
    font-size: 0.92rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    color: #ffffff;
}

.matches-painter-seg-modal-close {
    width: 26px;
    height: 26px;
    min-width: 26px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.18);
    color: #ffffff;
    font-size: 1rem;
    line-height: 1;
    font-weight: 800;
    cursor: pointer;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.matches-painter-seg-modal-close:hover {
    background: rgba(255, 255, 255, 0.28);
}

#matchesPainterSegModalBody {
    display: grid;
    gap: 7px;
    padding: 11px 12px 13px;
}

.matches-painter-seg-modal-line {
    border: 1px solid #cfddf0;
    border-radius: 9px;
    background: #f7fbff;
    color: #2a4f7b;
    font-size: 0.79rem;
    line-height: 1.32;
    font-weight: 700;
    padding: 8px 9px;
    word-break: break-word;
}

.matches-painter-seg-modal-line.head {
    border-color: #b8d0eb;
    background: linear-gradient(180deg, #edf6ff 0%, #e6f1ff 100%);
    color: #123f71;
    font-size: 0.83rem;
}

.chromopainter-seg.matches-seg {
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
    transform-origin: center;
}

.chromopainter-seg.matches-seg:hover {
    transform: translateY(-1px) scaleY(1.55);
    box-shadow: 0 0 0 1px rgba(255,255,255,0.3), 0 0 14px rgba(23, 75, 138, 0.45);
    filter: brightness(1.08);
    z-index: 20;
}

.matches-modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.matches-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
}

.matches-modal-card {
    position: relative;
    z-index: 2;
    width: min(900px, 92vw);
    max-height: 80vh;
    background: #181818;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.matches-modal-head {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.matches-modal-title {
    font-weight: 700;
    color: #e2e8f0;
}

.matches-modal-body {
    padding: 12px 16px;
    overflow: auto;
}

.matches-modal-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}

.matches-modal-table th,
.matches-modal-table td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--border-color);
    text-align: left;
}

@media (max-width: 1100px) {
    .matches-topbar {
        flex-direction: column;
        align-items: flex-start;
    }
    .matches-export {
        margin-left: 0;
        width: 100%;
    }
    .matches-export .green-btn {
        flex: 1;
    }
    .matches-painter-grid {
        grid-template-columns: 1fr;
    }
    .matches-painter-controls {
        width: 100%;
    }
    .matches-painter-controls > label {
        flex: 1 1 220px;
    }
    .matches-painter-check {
        padding-top: 0;
    }
}


/* =========================================
   CHILD SAMPLER
   ========================================= */
.childsampler-layout {
    display: grid;
    grid-template-columns: minmax(280px, 380px) 1fr;
    gap: 24px;
    height: 100%;
}

.childsampler-left,
.childsampler-right {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.childsampler-header {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.childsampler-title {
    font-size: 1.6rem;
    font-weight: 800;
    color: #ffffff;
    letter-spacing: 0.5px;
}

.childsampler-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.2em;
}

.childsampler-panel {
    background: var(--panel-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.childsampler-panel-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-muted);
    font-weight: 700;
}

.childsampler-status-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 10px;
    background: #1f1f1f;
    border: 1px solid #333;
    border-radius: 6px;
    font-size: 0.85rem;
}

.childsampler-status {
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid #333;
    background: #222;
    color: var(--text-muted);
}

.childsampler-status.ready {
    background: rgba(34, 197, 94, 0.15);
    color: var(--accent-green);
    border-color: var(--accent-green);
}

.childsampler-notes {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.childsampler-log-panel {
    flex: 1;
    min-height: 200px;
}

.childsampler-log-list {
    background: #1c1c1c;
    border: 1px solid #333;
    border-radius: 6px;
    padding: 10px;
    font-family: 'Consolas', monospace;
    font-size: 0.75rem;
    color: var(--text-muted);
    max-height: 220px;
    overflow-y: auto;
}

.childsampler-log-item {
    padding: 2px 0;
}

.childsampler-log-empty {
    color: #666;
    font-style: italic;
}

.childsampler-card {
    background: var(--panel-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.childsampler-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
}

.childsampler-card-title {
    font-size: 1rem;
    font-weight: 700;
    color: #ffffff;
}

.childsampler-card-subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.childsampler-remove {
    background: transparent;
    border: 1px solid #444;
    color: #ccc;
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: 999px;
    cursor: pointer;
}

.childsampler-remove:hover {
    border-color: var(--accent-red);
    color: #fff;
}

.childsampler-upload {
    border: 2px dashed #3b3b3b;
    border-radius: 8px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    background: #232323;
    cursor: pointer;
    text-align: center;
}

.childsampler-upload:hover {
    border-color: var(--accent-blue);
}

.childsampler-file-name {
    font-size: 0.85rem;
    color: #eaeaea;
}

.childsampler-file-hint {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.childsampler-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.childsampler-meta span:last-child {
    color: #fff;
    font-weight: 600;
}

.childsampler-badges {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.childsampler-badge {
    font-size: 0.7rem;
    padding: 4px 8px;
    border-radius: 999px;
    border: 1px solid #333;
    background: #1f1f1f;
    color: var(--text-muted);
}

.childsampler-badge.active-y {
    border-color: #3b82f6;
    color: #93c5fd;
    background: rgba(59, 130, 246, 0.15);
}

.childsampler-badge.active-mt {
    border-color: #ec4899;
    color: #f9a8d4;
    background: rgba(236, 72, 153, 0.15);
}

@media (max-width: 1100px) {
    .childsampler-layout {
        grid-template-columns: 1fr;
    }
}
/* Homepage Tab */
.homepage-shell {
    width: 100%;
    max-width: 1380px;
    margin: 0 auto;
    padding: 8px 4px 20px;
}
.homepage-hero {
    background: linear-gradient(135deg, #07172e 0%, #10345f 45%, #1f6aa5 100%);
    border: 1px solid #2f5f90;
    border-radius: 12px;
    padding: 24px;
    color: #e9f3ff;
    box-shadow: 0 14px 32px rgba(7, 23, 46, 0.45);
    margin-bottom: 18px;
}
.homepage-hero h1 {
    margin: 0 0 8px;
    font-size: 2rem;
    line-height: 1.15;
    font-weight: 800;
    color: #ffffff;
}
.homepage-hero p {
    margin: 0;
    max-width: 980px;
    color: #d8e9fb;
    font-size: 0.98rem;
    line-height: 1.5;
}
.homepage-quickstart {
    margin-top: 14px;
    background: rgba(10, 24, 44, 0.45);
    border: 1px solid rgba(169, 207, 245, 0.3);
    border-radius: 10px;
    padding: 12px 14px;
    display: grid;
    gap: 5px;
    font-size: 0.9rem;
}
.homepage-quickstart-title {
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: #9ed1ff;
    margin-bottom: 2px;
}
.homepage-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 12px;
}
.homepage-card {
    background: linear-gradient(180deg, #1e242d 0%, #171c23 100%);
    border: 1px solid #2e3947;
    border-radius: 10px;
    padding: 13px 14px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}
.homepage-card h3 {
    margin: 0 0 6px;
    font-size: 0.92rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #5fb1ff;
    font-weight: 800;
}
.homepage-card p {
    margin: 0;
    color: #c8d0dd;
    font-size: 0.88rem;
    line-height: 1.45;
}
@media (max-width: 900px) {
    .homepage-hero {
        padding: 18px;
    }
    .homepage-hero h1 {
        font-size: 1.55rem;
    }
}


.homepage-disclaimer {
    margin-top: 12px;
    padding: 10px 12px;
    border-radius: 9px;
    border: 1px solid rgba(159, 205, 246, 0.35);
    background: rgba(8, 20, 37, 0.52);
    color: #c7ddf2;
    font-size: 0.83rem;
    line-height: 1.4;
}

.homepage-card {
    cursor: pointer;
    transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.homepage-card:hover {
    transform: translateY(-2px);
    border-color: #3f6f9e;
    box-shadow: 0 10px 20px rgba(6, 16, 30, 0.34);
}

.homepage-card:active {
    transform: translateY(0);
}


.single-param-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.param-help-btn {
    width: 24px;
    height: 24px;
    min-width: 24px;
    padding: 0;
    border-radius: 50%;
    border: 1px solid #4b5563;
    background: #111827;
    color: #e5e7eb;
    font-weight: 700;
    font-size: 0.85rem;
    line-height: 1;
    text-transform: none;
}

.param-help-btn:hover {
    background: #1f6aa5;
    border-color: #1f6aa5;
}


.tab-help-fab {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 30;
}

#view-single .tab-help-fab {
    top: 18px;
}


#view-distance .tab-help-fab {
    top: 34px;
}
.hmv2-mode-tab-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    overflow: visible;
    position: relative;
    z-index: 5;
}

.hmv2-mode-tab-wrap .hmv2-mode-tab {
    flex: 1;
    width: auto !important;
    min-width: 0;
}

.hmv2-mode-help-btn {
    width: 24px !important;
    min-width: 24px !important;
    height: 24px !important;
    flex: 0 0 24px !important;
    padding: 0 !important;
    margin-top: 0 !important;
    margin-left: 4px !important;
    border-radius: 50% !important;
    border: 1px solid #4b5563 !important;
    background: #111827 !important;
    color: #e5e7eb !important;
    font-weight: 700 !important;
    font-size: 0.85rem !important;
    line-height: 1 !important;
    text-transform: none !important;
    position: relative !important;
    z-index: 10 !important;
}

.hmv2-mode-help-btn:hover {
    background: #1f6aa5 !important;
    border-color: #1f6aa5 !important;
}

.single-help-modal {
    position: fixed;
    inset: 0;
    background: rgba(8, 10, 14, 0.72);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 18px;
    z-index: 10020;
}

.single-help-modal.open {
    display: flex;
}

.single-help-card {
    width: min(760px, 96vw);
    max-height: 88vh;
    background: #1f2228;
    border: 1px solid #3b3f47;
    border-radius: 12px;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.single-help-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid #323742;
}

.single-help-head h3 {
    margin: 0;
    font-size: 1rem;
    color: #f3f4f6;
}

.single-help-body {
    padding: 14px 16px 16px;
    overflow-y: auto;
    color: #d1d5db;
    font-size: 0.9rem;
    line-height: 1.45;
}

.single-help-body p {
    margin: 0 0 10px;
}

.single-help-list {
    margin: 0 0 12px 18px;
    padding: 0;
}

.single-help-list li {
    margin: 0 0 8px;
}

.single-help-list strong {
    color: #f8fafc;
}

/* =========================================
   MULTI TAB
   ========================================= */
.multi-shell {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    height: 100%;
    min-height: 0;
}

.multi-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    background: linear-gradient(180deg, rgba(34, 39, 46, 0.86), rgba(21, 24, 30, 0.92));
    border: 1px solid #344050;
    border-radius: 10px;
    padding: 10px;
}

.multi-toolbar.secondary {
    padding: 8px 10px;
}

.multi-option {
    min-width: 200px;
}

.multi-option label {
    margin-bottom: 4px;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #9db3d0;
}

.multi-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #d8e3f4;
    font-size: 0.86rem;
    padding: 6px 8px;
    border: 1px solid #3a475a;
    border-radius: 8px;
    background: rgba(14, 19, 27, 0.68);
}

.multi-toggle input {
    margin: 0;
}

.multi-progress {
    height: 8px;
    background: #1a2230;
    border: 1px solid #31435a;
    border-radius: 999px;
    overflow: hidden;
}

.multi-progress .progress-bar {
    background: linear-gradient(90deg, #2ba9ff, #4fd17a);
}

.multi-table-wrap {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: auto;
    border: 1px solid #324158;
    border-radius: 10px;
    background: linear-gradient(180deg, rgba(20, 24, 30, 0.96), rgba(15, 18, 24, 0.98));
}

.multi-table {
    width: max-content;
    min-width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    font-size: 0.86rem;
}

.multi-table thead th {
    position: sticky;
    top: 0;
    z-index: 4;
    background: #142236;
    color: #e8f1ff;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 700;
    border-bottom: 1px solid #375172;
    border-right: 1px solid #2a3342;
    padding: 9px 11px;
    white-space: nowrap;
}

.multi-source-head {
    min-width: 300px;
    text-align: left;
}

.multi-head-target {
    min-width: 126px;
}

.multi-head-average {
    min-width: 126px;
    background: #13395d !important;
    color: #f2f8ff !important;
}

.multi-table td {
    border-right: 1px solid #29303e;
    border-bottom: 1px solid #242b37;
    padding: 8px 10px;
    text-align: center;
    min-width: 126px;
    color: #eff5ff;
}

.multi-target-cell {
    min-width: 300px;
    text-align: left !important;
    color: #e8eef8;
    font-weight: 650;
    white-space: nowrap;
    background: #1c2635;
}

.multi-distance-row .multi-target-cell {
    background: #17324e;
}

.multi-distance-cell {
    color: #9de1ff;
    font-family: Consolas, 'Courier New', monospace;
    background: #192433;
    font-weight: 700;
}

.multi-distance-cell.avg {
    background: #13395d;
    color: #f2f8ff;
}

.multi-zero {
    background: #1f2631;
    color: #536171;
}

.multi-pct-cell {
    color: #f8fbff;
    font-weight: 700;
    font-family: Consolas, 'Courier New', monospace;
}

.multi-pct-cell.avg {
    color: #ffffff;
    text-shadow: 0 1px 0 rgba(0, 0, 0, 0.35);
}

.multi-table .sticky-col {
    position: sticky;
    left: 0;
    z-index: 3;
}

.multi-table thead .sticky-col {
    z-index: 5;
}

@media (max-width: 1100px) {
    .multi-source-head,
    .multi-target-cell {
        min-width: 210px;
    }
    .multi-head-target,
    .multi-head-average,
    .multi-table td {
        min-width: 106px;
    }
}
.multi-shot-toggle {
    font-size: 0.8rem;
    white-space: nowrap;
}



#hmv2_pctPanel {
    background: transparent;
    border: none;
    padding: 0;
    margin-top: 10px;
}
#hmv2_pctPanel #hmv2_pctContent .single-res-card {
    margin: 0;
    padding: 14px;
    border: 1px solid #384253;
    background: #1d2430;
}
#hmv2_pctPanel #hmv2_pctContent .res-body {
    max-width: none;
}
#hmv2_pctPanel #hmv2_pctContent .group-section {
    max-width: none;
}
#hmv2_pctPanel #hmv2_pctContent .pop-row {
    grid-template-columns: minmax(0, 1fr) 150px;
}









/* Coordinates Generator Tab */
#view-coordgen {
    align-items: center;
    justify-content: flex-start;
}

.coordsgen-shell {
    width: 100%;
    display: flex;
    justify-content: center;
    padding: 6px 0 20px;
}

.coordsgen-card {
    width: min(920px, 100%);
    background: linear-gradient(180deg, #0f1e3c 0%, #0c1731 100%);
    border: 1px solid #26406f;
    border-radius: 14px;
    padding: 24px;
    box-shadow: 0 16px 50px rgba(0, 0, 0, 0.45);
}

.coordsgen-title {
    margin: 0 0 12px 0;
    font-size: clamp(24px, 3.2vw, 36px);
    line-height: 1.2;
    color: #eef4ff;
}

.coordsgen-desc {
    margin-bottom: 18px;
    background: rgba(12, 25, 49, 0.8);
    border: 1px solid #26406f;
    border-radius: 10px;
    padding: 14px;
    color: #b9c8e8;
    line-height: 1.5;
}

.coordsgen-controls {
    display: grid;
    gap: 14px;
    margin-bottom: 14px;
}

.coordsgen-controls label {
    margin-bottom: 4px;
    color: #dce8ff;
    font-size: 0.9rem;
    font-weight: 600;
}

.coordsgen-block {
    padding: 14px;
    background: rgba(8, 20, 43, 0.84);
    border: 1px solid #2a4778;
    border-radius: 10px;
    display: grid;
    gap: 10px;
}

.coordsgen-block-title {
    color: #e5efff;
    font-size: 0.98rem;
    font-weight: 700;
    margin: 0;
}

.coordsgen-form-grid {
    display: grid;
    grid-template-columns: minmax(260px, 1.45fr) minmax(220px, 1fr);
    gap: 12px;
    align-items: end;
}

.coordsgen-form-grid-single {
    grid-template-columns: minmax(240px, 1fr);
}

.coordsgen-field {
    display: grid;
    gap: 6px;
}

.coordsgen-file-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.coordsgen-file-name {
    color: #e7eefc;
    font-size: 0.95rem;
}

.coordsgen-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.coordsgen-actions-primary {
    margin-top: 4px;
}

.coordsgen-actions button,
.coordsgen-result-actions button {
    min-width: 210px;
}

.coordsgen-results-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.coordsgen-result-card {
    background: rgba(8, 20, 43, 0.84);
    border: 1px solid #2a4778;
    border-radius: 10px;
    padding: 12px;
    display: grid;
    gap: 8px;
}

.coordsgen-result-actions {
    display: flex;
    justify-content: flex-start;
}

.coordsgen-chrom-panel {
    margin-top: 2px;
    padding: 14px;
    background: rgba(8, 20, 43, 0.82);
    border: 1px solid #2a4778;
    border-radius: 10px;
    display: grid;
    gap: 10px;
}

.coordsgen-chrom-title {
    color: #d8e7ff;
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.coordsgen-chrom-sub {
    color: #9fb4d8;
    font-size: 0.82rem;
    line-height: 1.4;
    margin: 0;
}

.coordsgen-chrom-select {
    width: 100%;
    min-height: 128px;
    background: #091224;
    border: 1px solid #2a4778;
    border-radius: 8px;
    color: #dce9ff;
    padding: 8px;
    font-size: 0.9rem;
}

.coordsgen-chrom-select option {
    padding: 3px 6px;
}

.coordsgen-chrom-hint {
    margin: 0;
    color: #8da6ce;
    font-size: 0.78rem;
}

.coordsgen-output-chrom {
    min-height: 110px;
    color: #7dd3fc;
}

.coordsgen-output-unscaled {
    color: #fbbf24;
}

.coordsgen-unscaled-warning {
    margin-top: 0;
    background: rgba(120, 53, 15, 0.18);
    border: 1px solid rgba(245, 158, 11, 0.45);
    color: #fde68a;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 12px;
    line-height: 1.45;
}

.coordsgen-unscaled-warning-row {
    margin-top: -2px;
}

.coordsgen-progress-wrap {
    margin-top: 2px;
    padding: 10px 12px;
    background: rgba(8, 20, 43, 0.85);
    border: 1px solid #26406f;
    border-radius: 10px;
}

.coordsgen-progress-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
    color: #bfd4ff;
    font-size: 12px;
    font-family: 'Consolas', 'Courier New', monospace;
}

.coordsgen-progress-track {
    width: 100%;
    height: 9px;
    background: rgba(10, 22, 44, 0.95);
    border: 1px solid #2a4778;
    border-radius: 999px;
    overflow: hidden;
}

.coordsgen-progress-fill {
    width: 0%;
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #1ea3ff 0%, #2dd4bf 100%);
    transition: width 0.22s ease;
}

.coordsgen-output {
    width: 100%;
    min-height: 84px;
    resize: vertical;
    text-align: left;
    background: #050c1f;
    color: #4ade80;
    border: 1px solid #26406f;
    border-radius: 10px;
    padding: 14px;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 14px;
}

@media (max-width: 940px) {
    .coordsgen-form-grid,
    .coordsgen-results-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 760px) {
    .coordsgen-card {
        padding: 16px;
    }

    .coordsgen-actions button,
    .coordsgen-result-actions button {
        width: 100%;
        min-width: 0;
    }
}

.coordsgen-status-title {
    margin: 12px 0 6px 0;
    color: #b9c8e8;
    font-size: 13px;
    font-weight: 600;
}

.coordsgen-status-log {
    width: 100%;
    max-height: 120px;
    overflow: auto;
    background: #050c1f;
    border: 1px solid #26406f;
    border-radius: 10px;
    padding: 10px;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 12px;
    color: #a6c6ff;
    white-space: pre-wrap;
}

#view-heatmap .tab-help-fab,
#view-heatmapv2 .tab-help-fab {
    position: fixed !important;
    top: 14px !important;
    right: 4px !important;
    z-index: 12000 !important;
    width: 24px !important;
    min-width: 24px !important;
    height: 24px !important;
    flex: 0 0 24px !important;
    padding: 0 !important;
    margin: 0 !important;
    border-radius: 50% !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-sizing: border-box !important;
    line-height: 1 !important;
    pointer-events: auto;
}

/* =========================================
   GLOBAL RESPONSIVE HARDENING
   ========================================= */
@media (max-width: 1200px) {
    .container {
        padding: 16px 20px;
    }
}

@media (max-width: 980px) {
    .container {
        padding: 14px 14px 16px;
    }

    .data-load-container {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
        margin-top: 18px;
    }

    .load-box {
        align-items: stretch;
    }

    .big-btn {
        width: 100%;
        min-width: 0;
        padding: 14px 16px;
        font-size: 1rem;
    }

    .preset-calc-select {
        min-width: 0;
        width: 100%;
    }

    .data-source-picker-grid {
        grid-template-columns: 1fr;
    }

    .data-source-picker-actions {
        align-items: stretch;
    }

    .data-source-picker-mode-tabs {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin: 0 0 10px;
}

.data-source-mode-btn {
    border: 1px solid #3b6791;
    background: linear-gradient(180deg, #163c5b 0%, #122f49 100%);
    color: #dceeff;
    border-radius: 10px;
    padding: 8px 12px;
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.045em;
    cursor: pointer;
    transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.data-source-mode-btn:hover {
    transform: translateY(-1px);
    border-color: #5f8ebd;
    box-shadow: 0 6px 16px rgba(7, 21, 35, 0.24);
}

.data-source-mode-btn.active {
    background: linear-gradient(180deg, #1f6aa5 0%, #1a598a 100%);
    border-color: #7bb6df;
    color: #ffffff;
    box-shadow: 0 7px 18px rgba(12, 44, 70, 0.30);
}

.reverser-source-mode-row {
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.rev-source-mode-tabs {
    margin: 0;
}
.data-source-picker-actions > * {
        width: 100%;
    }

    .sidebar-layout {
        flex-direction: column;
        gap: 12px;
        height: auto;
        overflow: visible;
    }

    .sidebar-panel {
        width: 100%;
        border-right: 0;
        border-bottom: 1px solid #333;
        padding-right: 0;
        padding-bottom: 12px;
        overflow: visible;
    }

    .main-panel {
        width: 100%;
        min-height: 0;
        padding-left: 0 !important;
    }

    .pca-layout {
        flex-direction: column;
        height: auto;
    }

    .pca-panel.left,
    .pca-panel.center,
    .pca-panel.right {
        width: 100%;
        min-width: 0;
    }

    #pcaPlotWrapper {
        min-height: 360px;
    }

    .manual-subtab-nav {
        grid-template-columns: 1fr;
    }
    .manual-grid,
    .manual-creator-grid,
    .coord-editor-source-picker,
    .results-grid,
    .tm-grid {
        grid-template-columns: 1fr;
        height: auto;
    }

    .tm-shell {
        grid-template-columns: 1fr;
        height: auto;
    }
}

@media (max-width: 760px) {
    .navbar {
        padding: 8px 10px;
        gap: 6px;
    }

    .navbar a {
        font-size: 0.72rem;
        padding: 7px 9px;
    }

    .container {
        padding: 10px;
    }

    .inline-controls {
        flex-wrap: wrap;
        align-items: stretch;
        gap: 8px;
    }

    .inline-controls > * {
        flex: 1 1 100%;
        min-width: 0;
    }

    .search-bar {
        flex-wrap: wrap;
        border-radius: 10px;
        padding: 8px;
    }

    .search-bar label {
        width: 100%;
        margin-bottom: 0;
    }

    .search-bar input {
        width: 100%;
        min-width: 0;
        max-width: none;
    }

    .param-row {
        display: grid;
        grid-template-columns: 1fr;
        gap: 6px;
        align-items: stretch;
    }

    .param-row input,
    .param-row select,
    .input-group-small input {
        width: 100%;
    }

    .single-delete-controls {
        flex-wrap: wrap;
    }

    .single-delete-help-btn {
        margin-left: auto;
    }

    .pop-row {
        grid-template-columns: minmax(0, 1fr) 120px;
        column-gap: 10px;
    }

    .pop-bar-track {
        width: 60px;
    }
}

@media (max-width: 520px) {
    .multi-option {
        min-width: 0;
        width: 100%;
    }

    .results-toolbar input {
        flex: 1 1 100%;
        max-width: none;
    }
}










/* =========================================
   CHROMOSOME PAINTER TAB
   ========================================= */
.chromopainter-shell {
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-height: 0;
}

.chromopainter-top-card {
    background: linear-gradient(180deg, #17253b 0%, #121d2f 100%);
    border: 1px solid #2b3d59;
    border-radius: 14px;
    padding: 16px;
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.28);
}

.chromopainter-top-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 14px;
    cursor: pointer;
}

.chromopainter-panel-toggle {
    border: 1px solid #3b5f89;
    border-radius: 8px;
    background: linear-gradient(180deg, #203756 0%, #172a43 100%);
    color: #d8e9ff;
    font-weight: 800;
    font-size: 0.74rem;
    letter-spacing: 0.04em;
    padding: 7px 11px;
    cursor: pointer;
    white-space: nowrap;
    margin-right: 88px;
    flex-shrink: 0;
}

.chromopainter-panel-toggle:hover {
    filter: brightness(1.06);
}

.chromopainter-top-card.collapsed {
    padding-bottom: 12px;
}

.chromopainter-top-card.collapsed > :not(.chromopainter-top-head) {
    display: none;
}

.chromopainter-top-card.collapsed .chromopainter-title-wrap p {
    display: none;
}

.chromopainter-top-card.collapsed .chromopainter-top-head {
    margin-bottom: 0;
    align-items: center;
}

.chromopainter-title-wrap h2 {
    margin: 0;
    color: #eaf3ff;
    font-size: 1.3rem;
    letter-spacing: 0.01em;
}

.chromopainter-title-wrap p {
    margin: 6px 0 0;
    color: #9eb5d8;
    max-width: 920px;
    line-height: 1.4;
    font-size: 0.92rem;
}

.chromopainter-top-brand {
    font-family: 'Inter', 'Segoe UI', sans-serif;
    font-weight: 800;
    color: #7fc1ff;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    white-space: nowrap;
    font-size: 0.84rem;
    padding-top: 4px;
}

.chromopainter-control-grid {
    display: grid;
    grid-template-columns: minmax(280px, 1fr) minmax(260px, 340px);
    gap: 12px;
}

.chromopainter-control-block {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.chromopainter-file-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.chromopainter-file-name {
    font-size: 0.9rem;
    color: #d6e5ff;
    max-width: min(64ch, 100%);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chromopainter-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 12px;
}

.chromopainter-progress-wrap {
    margin-top: 10px;
    border: 1px solid #2c415f;
    border-radius: 10px;
    padding: 10px;
    background: rgba(7, 16, 31, 0.44);
}

.chromopainter-progress-head {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    font-size: 0.86rem;
    color: #b9d4f7;
    margin-bottom: 6px;
}

.chromopainter-progress-track {
    width: 100%;
    height: 9px;
    background: #0e1829;
    border-radius: 999px;
    overflow: hidden;
    border: 1px solid #324968;
}

.chromopainter-progress-fill {
    width: 0;
    height: 100%;
    background: linear-gradient(90deg, #2d8ded 0%, #69b6ff 100%);
    transition: width 0.24s ease;
}

.chromopainter-status-log {
    margin-top: 10px;
    border: 1px solid #2f4462;
    background: rgba(8, 14, 27, 0.76);
    border-radius: 10px;
    min-height: 58px;
    max-height: 112px;
    overflow: auto;
    padding: 10px;
    font-family: 'JetBrains Mono', Consolas, monospace;
    font-size: 0.79rem;
    line-height: 1.35;
    color: #bfdbfe;
    white-space: pre-wrap;
}

.chromopainter-history {
    margin-top: 10px;
    border: 1px solid #2f4462;
    border-radius: 10px;
    background: rgba(8, 14, 27, 0.66);
    padding: 10px;
}

.chromopainter-history-head {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    color: #d9eaff;
    font-size: 0.84rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.chromopainter-history-list {
    display: grid;
    gap: 6px;
    max-height: 160px;
    overflow: auto;
}

.chromopainter-history-item {
    width: 100%;
    border: 1px solid #35547b;
    border-radius: 9px;
    background: #111f33;
    color: #d2e4ff;
    padding: 8px 10px;
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 8px;
    align-items: center;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.16s ease, background 0.16s ease;
}

.chromopainter-history-item:hover {
    border-color: #4f7eb5;
    background: #142742;
}

.chromopainter-history-item.active {
    border-color: #3f8fe2;
    background: #17345a;
    box-shadow: inset 0 0 0 1px rgba(96, 173, 255, 0.35);
}

.chromopainter-history-time {
    font-family: 'JetBrains Mono', Consolas, monospace;
    color: #97bfe8;
    font-size: 0.76rem;
}

.chromopainter-history-target {
    color: #ecf5ff;
    font-size: 0.84rem;
    font-weight: 700;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chromopainter-history-dist {
    color: #7fc5ff;
    font-family: 'JetBrains Mono', Consolas, monospace;
    font-size: 0.78rem;
    font-weight: 700;
}

.chromopainter-history-empty {
    color: #a8c3e7;
    font-size: 0.83rem;
    padding: 10px;
    border: 1px dashed #33557f;
    border-radius: 8px;
    background: rgba(20, 34, 55, 0.6);
}

.chromopainter-history-note {
    margin-top: 8px;
    font-size: 0.76rem;
    color: #9fb9db;
}

.chromopainter-result-panel {
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.chromopainter-empty {
    border: 1px dashed #35557e;
    border-radius: 12px;
    background: rgba(14, 26, 44, 0.45);
    color: #99b4d8;
    padding: 28px 18px;
    text-align: center;
    font-weight: 600;
}

.chromopainter-export-card {
    background: radial-gradient(circle at 0% 0%, #f8fbff 0%, #edf3ff 62%, #e6eefc 100%);
    border: 1px solid #c9d9ef;
    border-radius: 14px;
    box-shadow: 0 16px 34px rgba(4, 22, 51, 0.25);
    color: #14355f;
    padding: 14px;
}

.chromopainter-export-header {
    border: 1px solid #d1e0f2;
    border-radius: 12px;
    background: linear-gradient(180deg, #ffffff 0%, #eef5ff 100%);
    padding: 12px;
    margin-bottom: 12px;
}

.chromopainter-export-brand {
    font-family: 'Inter', 'Segoe UI', sans-serif;
    font-weight: 800;
    font-size: 0.82rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #1d5ca2;
}

.chromopainter-export-target {
    margin-top: 4px;
    font-size: clamp(1.2rem, 2.1vw, 1.75rem);
    font-weight: 800;
    color: #153d71;
    line-height: 1.15;
    word-break: break-word;
}

.matches-painter-head-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.matches-painter-head-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.matches-painter-panel-toggle {
    border: 1px solid #9fc3eb;
    border-radius: 999px;
    background: #edf4ff;
    color: #1f4f84;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.03em;
    padding: 6px 11px;
    line-height: 1;
    cursor: pointer;
}

.matches-painter-panel-toggle:hover {
    background: #e3efff;
    border-color: #87b0df;
}

.matches-painter-help-btn {
    width: 28px;
    min-width: 28px;
    height: 28px;
    padding: 0;
    border-radius: 999px;
    font-size: 0.92rem;
    line-height: 1;
    align-self: flex-start;
}

#matches-painter-section.collapsed {
    padding-bottom: 10px;
}

#matches-painter-section.collapsed .chromopainter-export-meta,
#matches-painter-section.collapsed .matches-painter-controls,
#matches-painter-section.collapsed .chromopainter-export-grid {
    display: none;
}

.chromopainter-export-meta {
    margin-top: 7px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-family: 'JetBrains Mono', Consolas, monospace;
    font-size: 0.78rem;
    color: #245487;
}

.chromopainter-export-meta span {
    background: #e8f2ff;
    border: 1px solid #c7daf2;
    border-radius: 999px;
    padding: 4px 10px;
}

.chromopainter-export-grid {
    display: grid;
    grid-template-columns: minmax(310px, 0.95fr) minmax(470px, 1.45fr);
    gap: 12px;
}

.chromopainter-summary,
.chromopainter-paint {
    border: 1px solid #d1def0;
    border-radius: 12px;
    background: #f9fcff;
    padding: 10px;
    min-height: 0;
}

.chromopainter-summary-title,
.chromopainter-paint-title {
    color: #1d4f88;
    font-weight: 800;
    font-size: 1.05rem;
    letter-spacing: 0.02em;
}

.chromopainter-summary-total {
    color: #255992;
    margin-top: 4px;
    font-weight: 700;
}

.chromopainter-summary-controls {
    margin-top: 8px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.chromopainter-view-btn {
    border: 1px solid #bdd2ef;
    border-radius: 999px;
    background: #edf4ff;
    color: #235289;
    padding: 6px 12px;
    font-weight: 700;
    font-size: 0.8rem;
    cursor: pointer;
}

.chromopainter-view-btn.active {
    background: linear-gradient(90deg, #2f7fdb 0%, #4a95ea 100%);
    border-color: #2b77cd;
    color: #ffffff;
}

.chromopainter-view-btn:hover {
    filter: brightness(1.03);
}

.chromopainter-summary-scroll {
    margin-top: 10px;
    max-height: none;
    overflow: visible;
    padding-right: 0;
}

.chromopainter-summary-group {
    border: 1px solid #d6e2f3;
    border-radius: 10px;
    margin-bottom: 8px;
    background: #ffffff;
}

.chromopainter-summary-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    border-radius: 9px 9px 0 0;
    background: #d9e7f9;
    color: #1d446f;
    font-weight: 800;
    letter-spacing: 0.03em;
    padding: 6px 10px;
    text-transform: uppercase;
    font-size: 0.82rem;
}

.chromopainter-summary-row {
    padding: 8px 10px 8px;
    border-top: 1px solid #edf3fb;
}

.chromopainter-filter-row {
    cursor: pointer;
    transition: opacity 0.16s ease, background 0.16s ease;
}

.chromopainter-filter-row.selected {
    background: rgba(52, 118, 199, 0.11);
}

.chromopainter-filter-row.dimmed {
    opacity: 0.28;
}

.chromopainter-subgroup {
    border-top: 1px dashed #d7e2f3;
    padding: 6px 10px 8px;
    background: #f8fbff;
}

.chromopainter-subgroup-toggle {
    width: 100%;
    border: 1px solid #c9d9ef;
    border-radius: 8px;
    background: #edf4ff;
    color: #255386;
    display: grid;
    grid-template-columns: 18px 1fr auto;
    gap: 8px;
    align-items: center;
    padding: 6px 8px;
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 800;
}

.chromopainter-subgroup-toggle:hover {
    background: #e7f0fe;
}

.chromopainter-subgroup-plus {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #2f7fdb;
    color: #ffffff;
    font-size: 0.85rem;
    line-height: 1;
}

.chromopainter-subgroup-title {
    text-align: left;
}

.chromopainter-subgroup-total {
    font-family: 'JetBrains Mono', Consolas, monospace;
    color: #2a5c90;
}

.chromopainter-subgroup-body {
    display: none;
    margin-top: 6px;
    border: 1px solid #d8e4f4;
    border-radius: 8px;
    background: #ffffff;
}

.chromopainter-subgroup.open .chromopainter-subgroup-body {
    display: block;
}

.chromopainter-subgroup-row {
    padding: 7px 8px;
    border-top: 1px solid #edf3fb;
}

.chromopainter-subgroup-row:first-child {
    border-top: 0;
}

.chromopainter-summary-left {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    margin-bottom: 3px;
}

.chromopainter-name {
    color: #1c3f69;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.chromopainter-pct {
    float: right;
    color: #28568b;
    font-family: 'JetBrains Mono', Consolas, monospace;
    font-weight: 700;
}

.chromopainter-summary-bar {
    clear: both;
    height: 4px;
    border-radius: 999px;
    background: #e5edf8;
    overflow: hidden;
    margin-top: 5px;
}

.chromopainter-summary-bar span {
    display: block;
    height: 100%;
    border-radius: 999px;
}

.chromopainter-paint {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.chromopainter-legend {
    margin-top: 8px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 6px;
}

.chromopainter-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    background: #f0f6ff;
    border: 1px solid #d4e2f5;
    border-radius: 999px;
    padding: 5px 8px;
}

.chromopainter-legend-name {
    color: #214d7b;
    font-weight: 700;
    font-size: 0.8rem;
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chromopainter-legend-pct {
    color: #33679f;
    font-family: 'JetBrains Mono', Consolas, monospace;
    font-size: 0.78rem;
    font-weight: 700;
}

.chromopainter-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex: 0 0 10px;
    border: 1px solid rgba(17, 37, 64, 0.2);
}

.chromopainter-rows {
    margin-top: 10px;
    border: 1px solid #d6e3f5;
    border-radius: 10px;
    background: #ffffff;
    padding: 10px;
    display: grid;
    gap: 8px;
}

.chromopainter-chr-row {
    display: grid;
    grid-template-columns: 26px 1fr;
    gap: 8px;
    align-items: center;
}

.chromopainter-chr-label {
    color: #19467a;
    font-family: 'JetBrains Mono', Consolas, monospace;
    font-size: 0.82rem;
    font-weight: 800;
    text-align: right;
}

.chromopainter-chr-track {
    height: 12px;
    border-radius: 999px;
    overflow: hidden;
    background: #e4ecf9;
    border: 1px solid #ccdbef;
    display: flex;
    align-items: stretch;
}

.chromopainter-paint .chromopainter-chr-track {
    overflow: visible;
}

.chromopainter-chr-track-empty {
    background: repeating-linear-gradient(
        -45deg,
        #ebf2fd 0,
        #ebf2fd 4px,
        #dbe8f8 4px,
        #dbe8f8 8px
    );
}

.chromopainter-seg {
    min-width: 2px;
    display: block;
    height: 100%;
    flex: 0 0 auto;
    border-right: 1px solid rgba(255, 255, 255, 0.3);
    transition: opacity 0.12s ease;
}

.chromopainter-paint .chromopainter-seg {
    position: relative;
    cursor: pointer;
    transform-origin: center;
    transition: opacity 0.12s ease, transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
}

.chromopainter-paint .chromopainter-seg:hover {
    transform: translateY(-1px) scaleY(1.65);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.36), 0 0 14px rgba(31, 81, 143, 0.35);
    filter: brightness(1.08);
    z-index: 4;
}

.chromopainter-chr-track.filter-active {
    background: #edf3fc;
}

.chromopainter-seg.filtered-out {
    opacity: 0;
}

.chromopainter-trace {
    margin-top: 10px;
    border: 1px solid #d3deef;
    border-radius: 10px;
    background: #f2f5fa;
    overflow: hidden;
}

.chromopainter-trace-toggle {
    width: 100%;
    border: 0;
    background: #9599a1;
    color: #ffffff;
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: center;
    padding: 10px 12px;
    font-size: 0.95rem;
    font-weight: 800;
    letter-spacing: 0.01em;
    cursor: pointer;
}

.chromopainter-trace-toggle:hover {
    background: #878d96;
}

.chromopainter-trace-tip {
    display: none;
    border-top: 1px solid #d8dfec;
    background: #eef3fa;
    color: #49638a;
    font-size: 0.77rem;
    line-height: 1.35;
    padding: 8px 10px;
}

.chromopainter-trace:not(.open):hover .chromopainter-trace-tip {
    display: block;
}

.chromopainter-trace-body {
    display: none;
    border-top: 1px solid #d6e0ef;
    background: #ffffff;
}

.chromopainter-trace.open .chromopainter-trace-body {
    display: block;
}

.chromopainter-trace-row {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 8px;
    align-items: center;
    padding: 8px 10px;
    border-top: 1px solid #edf3fb;
}

.chromopainter-trace-row:first-child {
    border-top: 0;
}

.chromopainter-trace-name {
    color: #284d7a;
    font-weight: 700;
    min-width: 0;
    overflow-wrap: anywhere;
}

.chromopainter-trace-pct {
    color: #2f5e93;
    font-family: 'JetBrains Mono', Consolas, monospace;
    font-weight: 700;
}

.chromopainter-empty-mini {
    color: #3f6288;
    font-weight: 600;
    padding: 10px;
}

.chromopainter-seg-tooltip {
    position: fixed;
    z-index: 6100;
    max-width: 360px;
    background: rgba(11, 20, 36, 0.97);
    border: 1px solid #355070;
    border-radius: 10px;
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.45);
    padding: 8px 10px;
    pointer-events: none;
}

.chromopainter-seg-tooltip-line {
    color: #deebff;
    font-size: 0.78rem;
    line-height: 1.28;
    margin-top: 3px;
}

.chromopainter-seg-tooltip-line:first-child {
    margin-top: 0;
    color: #93c5fd;
    font-weight: 800;
}

.chromopainter-seg-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 6950;
    background: rgba(6, 14, 26, 0.22);
    backdrop-filter: blur(1.8px);
}

.chromopainter-seg-modal-card {
    position: fixed;
    left: -9999px;
    top: -9999px;
    min-width: 280px;
    width: min(420px, calc(100vw - 24px));
    border: 1px solid #b8cde9;
    border-radius: 12px;
    background: linear-gradient(180deg, #f8fbff 0%, #e9f2ff 100%);
    box-shadow: 0 20px 44px rgba(4, 21, 46, 0.36);
    color: #173a66;
    overflow: hidden;
}

.chromopainter-seg-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 12px;
    border-bottom: 1px solid #cbdbf0;
    background: linear-gradient(90deg, #2f7ad0 0%, #4f95e2 100%);
}

.chromopainter-seg-modal-title {
    font-size: 0.92rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    color: #ffffff;
}

.chromopainter-seg-modal-close {
    width: 26px;
    height: 26px;
    min-width: 26px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.18);
    color: #ffffff;
    font-size: 1rem;
    line-height: 1;
    font-weight: 800;
    cursor: pointer;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.chromopainter-seg-modal-close:hover {
    background: rgba(255, 255, 255, 0.28);
}

#chromPainterSegModalBody {
    display: grid;
    gap: 7px;
    padding: 11px 12px 13px;
}

.chromopainter-seg-modal-line {
    border: 1px solid #cfddf0;
    border-radius: 9px;
    background: #f7fbff;
    color: #2a4f7b;
    font-size: 0.79rem;
    line-height: 1.32;
    font-weight: 700;
    padding: 8px 9px;
    word-break: break-word;
}

.chromopainter-seg-modal-line.head {
    border-color: #b8d0eb;
    background: linear-gradient(180deg, #edf6ff 0%, #e6f1ff 100%);
    color: #123f71;
    font-size: 0.83rem;
}

@media (max-width: 1200px) {
    .chromopainter-export-grid {
        grid-template-columns: 1fr;
    }

    .chromopainter-summary-scroll {
        max-height: none;
        overflow: visible;
    }
}

@media (max-width: 900px) {
    .chromopainter-control-grid {
        grid-template-columns: 1fr;
    }

    .chromopainter-top-head {
        flex-direction: column;
    }

    .chromopainter-panel-toggle {
        align-self: flex-start;
        margin-right: 0;
    }

    .chromopainter-actions {
        width: 100%;
    }

    .chromopainter-actions .blue-btn,
    .chromopainter-actions .green-btn,
    .chromopainter-actions .red-btn {
        flex: 1 1 240px;
    }
}

/* Matches painter cross-reference visibility hardening */
#matches-painter-crossref-box {
    background: linear-gradient(180deg, #eef4fb 0%, #e5eef9 100%);
    border-color: #c6d8ee;
}

#matches-painter-crossref-box .chromopainter-trace-toggle {
    background: linear-gradient(180deg, #8f98a7 0%, #868f9e 100%);
    color: #ffffff;
    border: 1px solid #7e8796;
}

#matches-painter-crossref-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 420px;
    overflow: auto;
    padding: 4px 2px 2px;
}

.matches-painter-linkkit {
    border: 1px solid #c6d8ee;
    border-left: 4px solid var(--mp-link-color, #2d6bd8);
    border-radius: 10px;
    background: linear-gradient(180deg, #ffffff 0%, #f7fbff 100%);
    box-shadow: 0 5px 14px rgba(29, 73, 128, 0.08);
    overflow: hidden;
}

.matches-painter-linkkit-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 10px;
    background: #edf4ff;
    border-bottom: 1px solid #d8e5f6;
}

.matches-painter-linkkit-name {
    color: #1f4f84;
    font-size: 0.79rem;
    font-weight: 800;
    overflow-wrap: anywhere;
}

.matches-painter-linkkit-cm {
    color: #2f5e93;
    font-family: "JetBrains Mono", Consolas, monospace;
    font-size: 0.74rem;
    font-weight: 800;
    white-space: nowrap;
}

.matches-painter-linkkit-body {
    display: flex;
    flex-direction: column;
}

.matches-painter-link-row {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-top: 1px solid #e5eef9;
}

.matches-painter-link-row:first-child {
    border-top: none;
}

.matches-painter-link-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: var(--mp-link-color, #2d6bd8);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.92), 0 0 0 2px rgba(40, 99, 173, 0.22);
}

.matches-painter-link-name {
    color: #244b77;
    font-size: 0.77rem;
    font-weight: 700;
    min-width: 0;
    overflow-wrap: anywhere;
}

.matches-painter-link-pct {
    color: #2f5e93;
    font-family: "JetBrains Mono", Consolas, monospace;
    font-size: 0.75rem;
    font-weight: 800;
}

.matches-painter-link-empty {
    padding: 10px;
    color: #3d628c;
    font-size: 0.76rem;
    font-weight: 600;
}

/* Restore rounded edges in Chromosome Painter UI boxes/tracks */
.chromopainter-export-card,
.chromopainter-summary,
.chromopainter-paint,
.chromopainter-rows,
.chromopainter-summary-group,
.chromopainter-subgroup-body,
.matches-painter,
.matches-painter-map-wrap,
.matches-painter-summary,
.matches-painter-crossref-box {
    border-radius: 12px;
}

.chromopainter-chr-track {
    border-radius: 999px;
}

.chromopainter-seg {
    border-radius: 3px;
}

.chromopainter-chr-track .chromopainter-seg:first-child {
    border-top-left-radius: 999px;
    border-bottom-left-radius: 999px;
}

.chromopainter-chr-track .chromopainter-seg:last-child {
    border-top-right-radius: 999px;
    border-bottom-right-radius: 999px;
}


/* =========================================
   9.6 MODULE: G25 LAB
   ========================================= */
#view-g25lab {
    width: 100%;
    min-height: 0;
}
.g25lab-shell {
    width: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.g25lab-head {
    border: 1px solid #2a4670;
    border-radius: 12px;
    background: linear-gradient(180deg, #112544 0%, #0b1932 100%);
    padding: 12px 14px;
}
.g25lab-title {
    font-size: 1.06rem;
    font-weight: 900;
    letter-spacing: 0.03em;
    color: #d7ebff;
}
.g25lab-subtitle {
    margin-top: 4px;
    font-size: 0.84rem;
    color: #9fc1e7;
}
.g25lab-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}
.g25lab-card {
    border: 1px solid #3a3f46;
    border-radius: 12px;
    background: linear-gradient(180deg, #22252a 0%, #1a1d22 100%);
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}
.g25lab-card h3 {
    margin: 0;
    font-size: 0.92rem;
    letter-spacing: 0.03em;
    color: #e6eef9;
    font-weight: 900;
}
.g25lab-form-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}
.g25lab-form-row select,
.g25lab-form-row input[type="text"],
.g25lab-form-row input[type="number"] {
    background: #0f1626;
    border: 1px solid #35445e;
    color: #dce7fb;
    border-radius: 8px;
    padding: 6px 8px;
    min-width: 120px;
    font-size: 0.82rem;
}
.g25lab-check {
    display: inline-flex;
    gap: 5px;
    align-items: center;
    font-size: 0.78rem;
    color: #bdd0ee;
    font-weight: 700;
}
.g25lab-output {
    border: 1px solid #33465f;
    border-radius: 9px;
    background: #0b1321;
    color: #d7e9ff;
    padding: 8px;
    font-size: 0.8rem;
    line-height: 1.42;
    max-height: 260px;
    overflow: auto;
    white-space: pre-wrap;
}
.g25lab-output-text {
    min-height: 96px;
    resize: vertical;
    font-family: 'Consolas', 'JetBrains Mono', monospace;
}
.g25lab-status {
    font-size: 0.74rem;
    color: #9dc2eb;
}
.g25lab-badge {
    border: 1px solid #35567b;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 0.74rem;
    font-weight: 800;
    color: #cde2ff;
    background: #0f1e34;
}
.g25lab-mix-rows {
    border: 1px solid #354a67;
    border-radius: 10px;
    background: #101c2f;
    padding: 8px;
    display: grid;
    gap: 7px;
    max-height: 220px;
    overflow: auto;
}
.g25lab-mix-row {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) 90px 1fr;
    gap: 8px;
    align-items: center;
}
.g25lab-mix-name {
    font-size: 0.76rem;
    font-weight: 700;
    color: #d5e8ff;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.g25lab-mix-row input[type="range"] {
    width: 100%;
}
.g25lab-mix-row input[type="number"] {
    width: 88px;
    background: #0f1626;
    border: 1px solid #425472;
    color: #dbeaff;
    border-radius: 8px;
    padding: 5px 7px;
}
.g25lab-calc-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.g25lab-calc-grid select {
    width: 100%;
    border: 1px solid #3e516d;
    border-radius: 8px;
    background: #0f1626;
    color: #dce8fb;
    padding: 6px;
}
.g25lab-mini-label {
    display: block;
    margin-bottom: 4px;
    font-size: 0.75rem;
    color: #adc6e8;
    font-weight: 700;
}
.g25lab-selected-box {
    border: 1px solid #3d4f6a;
    border-radius: 8px;
    background: #0f1626;
    padding: 6px;
    max-height: 168px;
    overflow: auto;
    display: grid;
    gap: 4px;
}
.g25lab-selected-item {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    align-items: center;
    font-size: 0.76rem;
    color: #d8e8fe;
    border: 1px solid #415773;
    border-radius: 7px;
    padding: 4px 6px;
    background: #13233a;
}
.g25lab-selected-item button {
    padding: 2px 7px;
    font-size: 0.68rem;
}
.g25lab-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.78rem;
}
.g25lab-table th,
.g25lab-table td {
    border-bottom: 1px solid #293a52;
    padding: 6px 8px;
    text-align: left;
}
.g25lab-table th {
    color: #9fc2ed;
    font-weight: 800;
}
.g25lab-strong {
    font-weight: 800;
    color: #f0f7ff;
}
.g25lab-good { color: #6ee7b7; }
.g25lab-warn { color: #fbbf24; }
.g25lab-bad { color: #f87171; }

@media (max-width: 1200px) {
    .g25lab-grid {
        grid-template-columns: 1fr;
    }
    .g25lab-mix-row {
        grid-template-columns: 1fr;
    }
    .g25lab-calc-grid {
        grid-template-columns: 1fr;
    }
}


/* =========================================
   9.7 MODULE: TARGET COMPARER + G25 REPORT
   ========================================= */
#view-targetcomparer,
#view-g25report {
    width: 100%;
    min-height: 0;
}

.g25comp-shell,
.g25report-shell,
.g25mix-shell {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.g25comp-head,
.g25report-head,
.g25mix-head {
    border: 1px solid #2a4670;
    border-radius: 12px;
    background: linear-gradient(180deg, #112544 0%, #0b1932 100%);
    padding: 12px 14px;
}

.g25comp-title,
.g25report-title,
.g25mix-title {
    font-size: 1.06rem;
    font-weight: 900;
    letter-spacing: 0.03em;
    color: #d7ebff;
}

.g25comp-subtitle,
.g25report-subtitle,
.g25mix-subtitle {
    margin-top: 4px;
    font-size: 0.84rem;
    color: #9fc1e7;
}

.g25comp-controls,
.g25report-controls,
.g25mix-controls {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: flex-end;
}

.g25comp-field,
.g25report-field {
    min-width: 240px;
    display: grid;
    gap: 4px;
}

.g25comp-field label,
.g25report-field label {
    font-size: 0.75rem;
    font-weight: 700;
    color: #b8d2ee;
}

.g25comp-field select,
.g25report-field select {
    background: #0f1626;
    border: 1px solid #35445e;
    color: #dce7fb;
    border-radius: 8px;
    padding: 7px 9px;
    min-width: 220px;
    font-size: 0.82rem;
}

.g25comp-check,
.g25report-check {
    display: inline-flex;
    gap: 5px;
    align-items: center;
    font-size: 0.78rem;
    color: #bdd0ee;
    font-weight: 700;
}

.g25comp-output,
.g25report-output {
    border: 1px solid #33465f;
    border-radius: 10px;
    background: #0b1321;
    color: #d7e9ff;
    padding: 10px;
    font-size: 0.82rem;
    line-height: 1.42;
    min-height: 240px;
    max-height: 68vh;
    overflow: auto;
}

.g25report-note {
    border: 1px solid #35567b;
    border-radius: 10px;
    background: #0f1e34;
    color: #cde2ff;
    padding: 8px 10px;
    font-size: 0.78rem;
    font-weight: 700;
}

@media (max-width: 1000px) {
    .g25comp-controls,
    .g25report-controls,
    .g25mix-controls {
        align-items: stretch;
    }
    .g25comp-controls > *,
    .g25report-controls > *,
    .g25mix-controls > * {
        width: 100%;
    }
    .g25comp-field,
    .g25report-field {
        min-width: 0;
    }
}





.manual-panel-card {
    border: 1px solid #27466a;
    border-radius: 10px;
    padding: 10px;
    background: linear-gradient(180deg, rgba(15, 39, 63, 0.72) 0%, rgba(10, 29, 48, 0.68) 100%);
    box-shadow: 0 8px 20px rgba(5, 16, 30, 0.22);
}
.manual-subtab-title {
    color: #e1eeff;
    font-weight: 800;
    letter-spacing: 0.03em;
    font-size: 1.02rem;
}

/* ============================
   Genealogy Tab
============================ */
.genealogy-shell {
    display: grid;
    grid-template-columns: 1.15fr 1fr;
    gap: 12px;
    width: 100%;
}

.genealogy-col {
    min-width: 0;
}

.genealogy-panel {
    border: 1px solid rgba(102, 191, 255, 0.22);
    background: linear-gradient(145deg, rgba(10, 28, 52, 0.96), rgba(18, 43, 73, 0.94));
}

.genealogy-warning {
    border: 1px solid rgba(255, 205, 107, 0.35);
    background: rgba(41, 53, 63, 0.55);
    color: #ffd77d;
    border-radius: 10px;
    padding: 10px;
    font-weight: 600;
    margin-bottom: 10px;
}

.genealogy-toolbar-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(120px, 1fr));
    gap: 8px;
    margin-top: 6px;
}

.genealogy-inline-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.genealogy-tree-root {
    min-height: 260px;
    max-height: 860px;
    overflow: auto;
    border: 1px solid rgba(102, 191, 255, 0.2);
    border-radius: 10px;
    padding: 10px;
    background: rgba(8, 22, 40, 0.68);
}

.genealogy-node-block {
    margin: 6px 0;
}

.genealogy-node-card {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 8px;
    align-items: center;
    border: 1px solid rgba(102, 191, 255, 0.30);
    border-radius: 10px;
    padding: 8px;
    background: linear-gradient(180deg, rgba(20, 45, 75, 0.70), rgba(12, 30, 52, 0.76));
}

.genealogy-node-card.selected {
    box-shadow: 0 0 0 2px rgba(81, 175, 255, 0.45) inset;
}

.genealogy-node-card.loop {
    border-color: rgba(248, 113, 113, 0.6);
}

.genealogy-collapse-btn {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 1px solid rgba(143, 207, 255, 0.45);
    background: rgba(14, 57, 96, 0.72);
    color: #d8ecff;
    font-weight: 700;
}

.genealogy-node-main {
    cursor: pointer;
}

.genealogy-node-head {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: space-between;
}

.genealogy-node-name {
    font-weight: 800;
    color: #ecf6ff;
}

.genealogy-node-meta {
    font-size: 0.83rem;
    color: #b8d8f2;
    margin-top: 2px;
}

.genealogy-badge {
    font-size: 0.72rem;
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 700;
}

.genealogy-badge-observed {
    background: rgba(34, 197, 94, 0.22);
    color: #93f5b6;
}

.genealogy-badge-inferred {
    background: rgba(244, 114, 182, 0.20);
    color: #ffc6e8;
}

.genealogy-badge-hybrid {
    background: rgba(250, 204, 21, 0.20);
    color: #ffe488;
}

.genealogy-node-actions {
    display: flex;
    gap: 4px;
}

.tiny-btn {
    border: 1px solid rgba(111, 187, 247, 0.4);
    background: rgba(19, 89, 146, 0.72);
    color: #ecf8ff;
    border-radius: 8px;
    padding: 5px 8px;
    font-size: 0.74rem;
    font-weight: 700;
}

.tiny-btn.danger {
    border-color: rgba(245, 131, 131, 0.45);
    background: rgba(142, 39, 39, 0.64);
}

.genealogy-parent-row {
    margin-top: 6px;
    margin-left: 26px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    border-left: 2px solid rgba(120, 189, 247, 0.24);
    padding-left: 8px;
}

.genealogy-parent-label {
    color: #9fc7e8;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 4px;
}

.genealogy-missing,
.genealogy-empty {
    color: #9ab9d3;
    font-size: 0.88rem;
    border: 1px dashed rgba(137, 188, 228, 0.28);
    border-radius: 8px;
    padding: 8px;
}

.genealogy-node-kv-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 5px 10px;
    color: #d0e6f8;
    font-size: 0.87rem;
}

.genealogy-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.genealogy-constraint-list {
    margin-top: 6px;
    display: grid;
    gap: 5px;
}

.genealogy-constraint-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    border: 1px solid rgba(102, 191, 255, 0.2);
    border-radius: 8px;
    padding: 6px 8px;
    color: #d2e8fa;
}

.genealogy-split-grid {
    display: grid;
    grid-template-columns: 1fr 0.9fr;
    gap: 10px;
}

.genealogy-ancestry-table {
    max-height: 310px;
    overflow: auto;
    border: 1px solid rgba(102, 191, 255, 0.22);
    border-radius: 8px;
    padding: 8px;
    background: rgba(5, 18, 35, 0.45);
}

.genealogy-anc-row {
    display: grid;
    grid-template-columns: 1.2fr 1fr auto;
    align-items: center;
    gap: 8px;
    margin-bottom: 5px;
}

.genealogy-anc-name {
    color: #deefff;
    font-size: 0.84rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.genealogy-anc-bar-wrap {
    height: 7px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(205, 228, 246, 0.22);
}

.genealogy-anc-bar {
    height: 100%;
    background: linear-gradient(90deg, #2f97e1, #46e0ba);
}

.genealogy-anc-pct {
    color: #9ee8ca;
    font-size: 0.82rem;
    font-weight: 700;
}

.genealogy-provenance-list {
    margin: 0;
    padding-left: 18px;
    max-height: 310px;
    overflow: auto;
    border: 1px solid rgba(102, 191, 255, 0.22);
    border-radius: 8px;
    background: rgba(5, 18, 35, 0.45);
    color: #cde7fc;
    font-size: 0.82rem;
}

.genealogy-provenance-list li {
    margin: 6px 0;
}

@media (max-width: 1300px) {
    .genealogy-shell {
        grid-template-columns: 1fr;
    }
    .genealogy-split-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================
   Genealogy UX Revamp
============================ */
.genealogy-shell {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.genealogy-main-grid {
    display: grid;
    grid-template-columns: 1.04fr 1fr;
    gap: 12px;
}

.genealogy-hero-panel {
    border: 1px solid rgba(91, 179, 243, 0.34);
    box-shadow: 0 10px 28px rgba(4, 14, 28, 0.35);
}

.genealogy-subtitle {
    color: #c8e5ff;
    margin-top: 4px;
    font-size: 0.96rem;
}

.genealogy-quickstart-bar {
    margin-top: 10px;
    display: grid;
    grid-template-columns: 1.2fr auto;
    gap: 10px;
    align-items: end;
}

.genealogy-guide-grid {
    margin-top: 10px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.genealogy-guide-card {
    border: 1px solid rgba(128, 197, 250, 0.3);
    border-radius: 10px;
    padding: 10px;
    background: linear-gradient(165deg, rgba(11, 33, 57, 0.84), rgba(9, 25, 45, 0.82));
}

.genealogy-guide-card h3 {
    margin: 0 0 8px;
    color: #e8f5ff;
    font-size: 1rem;
}

.genealogy-guide-list,
.genealogy-guide-bullets {
    margin: 0;
    padding-left: 18px;
    color: #cae7ff;
    line-height: 1.52;
    font-size: 0.89rem;
}

.genealogy-guide-list li,
.genealogy-guide-bullets li {
    margin-bottom: 7px;
}

.genealogy-guide-pill {
    display: inline-block;
    min-width: 64px;
    text-align: center;
    margin-right: 8px;
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid rgba(131, 189, 235, 0.45);
    font-weight: 800;
    font-size: 0.74rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.genealogy-guide-pill.pending {
    color: #c0dbef;
    background: rgba(61, 92, 119, 0.35);
}

.genealogy-guide-pill.done {
    color: #8ef0b4;
    background: rgba(17, 105, 65, 0.34);
    border-color: rgba(92, 203, 145, 0.6);
}

.genealogy-advanced-panel {
    border: 1px solid rgba(102, 191, 255, 0.24);
}

.genealogy-advanced-panel summary {
    cursor: pointer;
    font-weight: 800;
    color: #d5ecff;
}

.genealogy-advanced-panel[open] {
    padding-bottom: 10px;
}

.genealogy-toolbar-grid {
    grid-template-columns: repeat(4, minmax(140px, 1fr));
}

.genealogy-dual-entry {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.genealogy-node-advanced {
    border: 1px solid rgba(122, 195, 245, 0.25);
    border-radius: 10px;
    padding: 8px;
    background: rgba(8, 24, 43, 0.6);
}

.genealogy-node-advanced summary {
    cursor: pointer;
    font-weight: 700;
    color: #cfe9ff;
}

@media (max-width: 1400px) {
    .genealogy-main-grid {
        grid-template-columns: 1fr;
    }
    .genealogy-toolbar-grid {
        grid-template-columns: repeat(3, minmax(130px, 1fr));
    }
}

@media (max-width: 1050px) {
    .genealogy-guide-grid,
    .genealogy-dual-entry,
    .genealogy-quickstart-bar {
        grid-template-columns: 1fr;
    }
    .genealogy-toolbar-grid {
        grid-template-columns: repeat(2, minmax(120px, 1fr));
    }
}

@media (max-width: 700px) {
    .genealogy-toolbar-grid,
    .genealogy-form-grid,
    .genealogy-node-kv-grid,
    .genealogy-split-grid {
        grid-template-columns: 1fr;
    }
}

/* Genealogy overlap hardening */
.genealogy-node-card {
    overflow: hidden;
}

.genealogy-node-main {
    min-width: 0;
}

.genealogy-node-head {
    flex-wrap: wrap;
    row-gap: 4px;
}

.genealogy-node-name,
.genealogy-node-meta {
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.genealogy-node-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
}

.genealogy-parent-col {
    min-width: 0;
}

.genealogy-parent-row {
    grid-template-columns: repeat(2, minmax(320px, 1fr));
    align-items: start;
}

@media (max-width: 980px) {
    .genealogy-parent-row {
        grid-template-columns: 1fr;
    }
}

/* Genealogy guided page revamp */
.genealogy-v3 {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
}

.genealogy-v3-section {
    border: 1px solid rgba(102, 191, 255, 0.24);
    background: linear-gradient(145deg, rgba(10, 28, 52, 0.95), rgba(17, 42, 71, 0.92));
}

.genealogy-v3-hero {
    box-shadow: 0 10px 28px rgba(4, 14, 28, 0.35);
}

.genealogy-v3-subtitle {
    color: #cfe7ff;
    margin: 4px 0 0;
    font-size: 0.95rem;
    line-height: 1.4;
}

.genealogy-v3-quick-actions {
    margin-top: 10px;
    display: grid;
    grid-template-columns: minmax(260px, 1.2fr) auto;
    gap: 10px;
    align-items: end;
}

.genealogy-v3-step-cards {
    margin-top: 10px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 10px;
}

.genealogy-v3-step-card {
    border: 1px solid rgba(120, 194, 245, 0.28);
    border-radius: 10px;
    padding: 10px;
    background: linear-gradient(165deg, rgba(11, 33, 57, 0.84), rgba(9, 25, 45, 0.82));
}

.genealogy-v3-step-top {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.genealogy-v3-step-card p {
    margin: 0;
    color: #c4ddf4;
    line-height: 1.45;
    font-size: 0.88rem;
}

.genealogy-v3-dual {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.genealogy-v3-box {
    border: 1px solid rgba(114, 188, 240, 0.24);
    border-radius: 10px;
    padding: 10px;
    background: rgba(7, 22, 40, 0.55);
}

.genealogy-parent-split-table {
    border: 1px solid rgba(102, 191, 255, 0.22);
    border-radius: 8px;
    background: rgba(5, 18, 35, 0.45);
    max-height: 460px;
    overflow: auto;
}

.genealogy-parent-split-head,
.genealogy-parent-split-row {
    display: grid;
    grid-template-columns: minmax(220px, 1.3fr) 150px 130px 100px 100px;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
}

.genealogy-parent-split-head {
    position: sticky;
    top: 0;
    z-index: 2;
    background: rgba(13, 40, 66, 0.95);
    color: #dff2ff;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 700;
    border-bottom: 1px solid rgba(102, 191, 255, 0.24);
}

.genealogy-parent-split-row {
    border-bottom: 1px solid rgba(102, 191, 255, 0.16);
}

.genealogy-parent-split-row.selected {
    background: rgba(45, 104, 152, 0.18);
}

.genealogy-parent-split-name {
    color: #e3f2ff;
    font-size: 0.84rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.genealogy-split-pct-btn {
    border: 1px solid rgba(108, 188, 247, 0.35);
    background: rgba(17, 56, 90, 0.72);
    color: #aff4d0;
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 0.82rem;
    font-weight: 800;
    cursor: pointer;
}

.genealogy-split-pct-btn.selected {
    background: rgba(31, 137, 99, 0.44);
    border-color: rgba(114, 229, 179, 0.75);
    color: #dcfff0;
}

.genealogy-parent-split-assigned {
    font-size: 0.82rem;
    font-weight: 800;
}

.genealogy-parent-split-assigned.father {
    color: #8fcbff;
}

.genealogy-parent-split-assigned.mother {
    color: #f0c6ff;
}

.genealogy-parent-split-assigned.balanced {
    color: #ffe3a1;
}

.genealogy-parent-split-side {
    color: #a6dfbf;
    font-size: 0.82rem;
    font-weight: 700;
}

@media (max-width: 1100px) {
    .genealogy-v3-quick-actions,
    .genealogy-v3-dual {
        grid-template-columns: 1fr;
    }
    .genealogy-parent-split-head,
    .genealogy-parent-split-row {
        grid-template-columns: 1fr;
    }
}
/* Genealogy family-tree visual polish (non-vertical layout) */
.genealogy-main-grid {
    align-items: start;
}

.genealogy-tree-root {
    background: radial-gradient(circle at top, rgba(25, 60, 96, 0.45), rgba(8, 22, 40, 0.76));
}

.genealogy-node-card {
    border-radius: 12px;
    box-shadow: 0 8px 18px rgba(4, 16, 32, 0.22);
}

.genealogy-node-card.selected {
    box-shadow: 0 0 0 2px rgba(90, 190, 255, 0.52) inset, 0 10px 20px rgba(3, 18, 36, 0.28);
}

.genealogy-node-name {
    font-size: 0.98rem;
    line-height: 1.25;
}

.genealogy-node-meta {
    font-size: 0.8rem;
}

.genealogy-node-mix {
    margin-top: 4px;
    font-size: 0.74rem;
    color: #a8d8ff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.genealogy-parent-row {
    margin-left: 34px;
    padding-left: 14px;
    border-left: 2px dashed rgba(126, 195, 247, 0.45);
}

.genealogy-parent-col {
    position: relative;
    padding-top: 4px;
}

.genealogy-parent-col::before {
    content: '';
    position: absolute;
    left: -14px;
    top: 22px;
    width: 14px;
    border-top: 2px dashed rgba(126, 195, 247, 0.45);
}

.genealogy-parent-label {
    font-weight: 700;
    color: #b7dcfa;
}

#genealogyParentSplitSection .panel-title {
    color: #d9eeff;
}

#genealogyParentSplitSection .mini-help {
    color: #b7d9f5;
    line-height: 1.45;
}
.coord-editor-source-helper {
    margin-top: 8px;
    color: #9fc8ff;
    font-size: 0.92rem;
}

/* Extra spacing for Coordinate Editor source controls (avoid cramped buttons). */
#coordEditorSourceBody .coord-editor-source-top {
    gap: 14px;
    row-gap: 12px;
    margin-bottom: 6px;
}

#coordEditorSourceModeTabs {
    gap: 12px;
    margin: 6px 0 12px;
}

#coordEditorSourceModeTabs .data-source-mode-btn {
    min-height: 34px;
    padding: 8px 14px;
}
