:root {
    --map-ink: #17344d;
    --map-muted: #5f7282;
    --map-line: #ded7c7;
    --map-gold: #bd8427;
    --map-panel: #fffdf8;
}

.mindmap-page {
    width: min(1500px, calc(100% - 32px));
    margin: 0 auto 28px;
}

.mindmap-hero {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 22px;
    min-height: 142px;
    margin: 18px 0;
    padding: 25px 30px;
    overflow: hidden;
    border: 1px solid #d7cba9;
    border-radius: 18px;
    background: linear-gradient(135deg, #fffdf7 0%, #f4e8bd 100%);
    box-shadow: 0 9px 25px rgba(66, 51, 25, 0.08);
}

.mindmap-hero::after {
    content: "";
    position: absolute;
    right: -70px;
    top: -110px;
    width: 330px;
    height: 330px;
    border-radius: 50%;
    background: rgba(190, 144, 47, 0.08);
    pointer-events: none;
}

.mindmap-eyebrow,
.mindmap-sidebar-eyebrow {
    margin: 0;
    color: #b57818;
    font-size: 0.76rem;
    font-weight: 900;
    letter-spacing: 0.11em;
    text-transform: uppercase;
}

.mindmap-hero h1 {
    margin: 3px 0 6px;
    color: #173f65;
    font-size: clamp(2rem, 3vw, 3rem);
    line-height: 1.05;
}

.mindmap-hero p:last-child {
    max-width: 850px;
    margin: 0;
    color: #4c6171;
    line-height: 1.55;
}

.mindmap-hero-actions,
.mindmap-hero-icon {
    position: relative;
    z-index: 1;
}

.mindmap-hero-button {
    min-height: 42px;
    padding: 0 16px;
    border: 1px solid #9a681b;
    border-radius: 9px;
    background: #ad7420;
    color: white;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}

.mindmap-hero-icon {
    display: grid;
    width: 68px;
    height: 68px;
    place-items: center;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.72);
    font-size: 2rem;
    box-shadow: 0 8px 20px rgba(88, 63, 20, 0.08);
}

.mindmap-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 13px;
    margin-bottom: 18px;
}

.mindmap-summary article {
    display: flex;
    align-items: center;
    gap: 13px;
    min-height: 78px;
    padding: 13px 17px;
    border: 1px solid #dce4e9;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 7px 20px rgba(24, 49, 72, 0.065);
}

.mindmap-summary article > span {
    display: grid;
    flex: 0 0 43px;
    width: 43px;
    height: 43px;
    place-items: center;
    border-radius: 11px;
    background: #f5ecd9;
    font-size: 1.24rem;
}

.mindmap-summary strong,
.mindmap-summary small {
    display: block;
}

.mindmap-summary strong {
    color: #24577f;
    font-size: 1.5rem;
    line-height: 1;
}

.mindmap-summary small {
    margin-top: 5px;
    color: var(--map-muted);
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.mindmap-workspace {
    min-height: 760px;
    overflow: hidden;
    border: 1px solid var(--map-line);
    border-radius: 17px;
    background: #fff;
    box-shadow: 0 10px 30px rgba(55, 43, 24, 0.08);
}

.mindmap-workspace:fullscreen {
    width: 100vw;
    height: 100vh;
    border: 0;
    border-radius: 0;
    background: #f4f0e7;
}

.mindmap-toolbar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    padding: 13px 15px;
    border-bottom: 1px solid var(--map-line);
    background: linear-gradient(180deg, #fffdf8, #f9f4e9);
}

.mindmap-search {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
    min-width: 220px;
    padding: 0 12px;
    border: 1px solid #cbd5dd;
    border-radius: 10px;
    background: #fff;
}

.mindmap-search input {
    width: 100%;
    min-height: 39px;
    border: 0;
    outline: 0;
    background: transparent;
    font: inherit;
}

.mindmap-type-filters,
.mindmap-toolbar-actions {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 7px;
}

.mindmap-type-filters {
    justify-content: center;
}

.mindmap-toolbar-actions {
    justify-content: flex-end;
}

.mindmap-toolbar button {
    min-height: 38px;
    padding: 0 11px;
    border: 1px solid #c9d4dc;
    border-radius: 8px;
    background: #fff;
    color: #294961;
    font: inherit;
    font-size: 0.8rem;
    font-weight: 800;
    cursor: pointer;
}

.mindmap-toolbar button:hover {
    border-color: #b68a3d;
    background: #fff9ec;
}

.mindmap-filter.active {
    border-color: #b68a3d;
    background: #f5ead4;
    color: #755018;
}

.mindmap-save-button {
    border-color: #96631b !important;
    background: #ad7420 !important;
    color: #fff !important;
}

.mindmap-content {
    display: grid;
    grid-template-columns: 270px minmax(0, 1fr);
    height: 690px;
    min-height: 690px;
}

.mindmap-workspace:fullscreen .mindmap-content {
    height: calc(100vh - 65px);
}

.mindmap-sidebar {
    overflow-y: auto;
    border-right: 1px solid var(--map-line);
    background: #fbfaf6;
}

.mindmap-sidebar-section {
    padding: 19px;
    border-bottom: 1px solid #e6dfd2;
}

.mindmap-sidebar-section h2 {
    margin: 5px 0 13px;
    color: var(--map-ink);
    font-size: 1.12rem;
}

.mindmap-legend {
    display: grid;
    gap: 11px;
}

.mindmap-legend > div {
    display: flex;
    align-items: center;
    gap: 10px;
}

.mindmap-legend strong,
.mindmap-legend small {
    display: block;
}

.mindmap-legend strong {
    color: #193c5a;
    font-size: 0.88rem;
}

.mindmap-legend small {
    margin-top: 2px;
    color: #607281;
    font-size: 0.72rem;
    line-height: 1.25;
}

.legend-swatch {
    display: grid;
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    place-items: center;
    border-radius: 9px;
    border: 1px solid #d0d8de;
}

.legend-topic {
    background: #173f65;
    color: #fff;
}

.legend-subject {
    background: #f1d38f;
    border-color: #c68a27;
}

.legend-focus {
    background: #fff;
    border-color: #9baebc;
}

.mindmap-color-note {
    margin-top: 16px;
    padding: 11px 12px;
    border: 1px solid #e6d4aa;
    border-radius: 9px;
    background: #fff8e8;
    color: #665333;
    font-size: 0.76rem;
    line-height: 1.45;
}

.mindmap-color-note strong {
    display: block;
    margin-bottom: 3px;
    color: #775314;
}

.mindmap-selection-icon {
    display: grid;
    width: 54px;
    height: 54px;
    margin: 14px auto 8px;
    place-items: center;
    border-radius: 50%;
    background: #f2e7cc;
    font-size: 1.5rem;
}

#mindmapSelectionEmpty {
    text-align: center;
}

#mindmapSelectionEmpty p {
    margin: 0;
    color: #5d7486;
    font-size: 0.8rem;
    line-height: 1.5;
}

.hidden {
    display: none !important;
}

.mindmap-selected-type {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-top: 10px;
    padding: 5px 8px;
    border-radius: 999px;
    background: #efe5cf;
    color: #76551d;
    font-size: 0.7rem;
    font-weight: 900;
    text-transform: uppercase;
}

.mindmap-selection h2 {
    overflow-wrap: anywhere;
}

.mindmap-selected-path {
    padding: 9px 10px;
    border-radius: 8px;
    background: #f5f7f8;
    color: #536b7e;
    font-size: 0.74rem;
    line-height: 1.4;
}

.mindmap-selected-path span {
    color: #b27a22;
    font-weight: 900;
}

.mindmap-selected-facts {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 7px;
    margin: 12px 0;
}

.mindmap-selected-facts div {
    padding: 8px;
    border: 1px solid #e0e5e8;
    border-radius: 8px;
    background: #fff;
}

.mindmap-selected-facts dt {
    color: #738391;
    font-size: 0.66rem;
    font-weight: 800;
    text-transform: uppercase;
}

.mindmap-selected-facts dd {
    margin: 3px 0 0;
    color: #1d445f;
    font-size: 0.84rem;
    font-weight: 800;
}

.mindmap-open-link {
    display: block;
    padding: 9px 10px;
    border-radius: 8px;
    background: #173f65;
    color: #fff !important;
    text-align: center;
    text-decoration: none;
    font-size: 0.78rem;
    font-weight: 800;
}

.mindmap-help ul {
    margin: 10px 0 0;
    padding-left: 18px;
    color: #5c7181;
    font-size: 0.76rem;
    line-height: 1.65;
}

.mindmap-private-tip {
    margin: 13px 0 0;
    padding: 9px;
    border-radius: 8px;
    background: #eef5ec;
    color: #496244;
    font-size: 0.72rem;
}

.mindmap-canvas-shell {
    position: relative;
    min-width: 0;
    height: 100%;
    overflow: hidden;
    background: #f8f9fa;
}

#mindmapNetwork {
    position: absolute;
    inset: 0 0 36px 0;
    width: 100%;
    height: calc(100% - 36px);
    border: 0;
    background-color: #f8f9fa;
    background-image: radial-gradient(circle, rgba(61, 91, 115, 0.12) 1px, transparent 1px);
    background-size: 25px 25px;
}

#mindmapNetwork.node-hovering canvas {
    cursor: pointer !important;
}

.mindmap-loading {
    position: absolute;
    z-index: 5;
    inset: 0 0 36px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: rgba(248, 249, 250, 0.93);
    color: #254e6e;
}

.mindmap-loading-spinner {
    width: 32px;
    height: 32px;
    border: 4px solid #d7e0e6;
    border-top-color: #b77d22;
    border-radius: 50%;
    animation: mindmap-spin 0.8s linear infinite;
}

@keyframes mindmap-spin {
    to { transform: rotate(360deg); }
}

.mindmap-load-error {
    max-width: 430px;
    padding: 18px;
    text-align: center;
}

.mindmap-load-error span {
    display: block;
    margin-bottom: 8px;
    font-size: 2rem;
}

.mindmap-load-error p {
    color: #6e4b4b;
}

.mindmap-canvas-footer {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 36px;
    padding: 0 13px;
    border-top: 1px solid #e0e4e7;
    background: #fff;
    color: #607587;
    font-size: 0.74rem;
}

#saveStatus.saving { color: #996315; }
#saveStatus.saved { color: #2c7a45; }
#saveStatus.failed { color: #aa3535; }

@media (max-width: 1100px) {
    .mindmap-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .mindmap-toolbar {
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    .mindmap-search {
        width: 100%;
    }

    .mindmap-type-filters,
    .mindmap-toolbar-actions {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
    }

    .mindmap-content {
        grid-template-columns: 225px minmax(0, 1fr);
    }
}

@media (max-width: 760px) {
    .mindmap-page {
        width: min(100% - 14px, 1500px);
    }

    .mindmap-hero {
        grid-template-columns: 1fr;
        padding: 20px;
    }

    .mindmap-hero-icon {
        display: none;
    }

    .mindmap-summary {
        grid-template-columns: 1fr 1fr;
    }

    .mindmap-content {
        display: block;
        height: 720px;
    }

    .mindmap-sidebar {
        display: none;
    }

    .mindmap-toolbar-actions,
    .mindmap-type-filters {
        width: 100%;
    }
}

/* v2 deployment marker: makes it obvious that the cache-busted map loaded. */
.mindmap-build-badge {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 0 10px;
    border: 1px solid #d2b15f;
    border-radius: 8px;
    background: #fff8df;
    color: #75500b;
    font-size: 11px;
    font-weight: 800;
    white-space: nowrap;
}

/* ===== v5 connection editor ===== */
.mindmap-connections-block {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid #e1d8c6;
}

.mindmap-connections-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.mindmap-connections-heading h3 {
    margin: 0;
    font-size: 15px;
    color: #123f66;
}

.mindmap-connections-heading span {
    min-width: 25px;
    padding: 2px 7px;
    border-radius: 999px;
    background: #f3e8cf;
    color: #7a5410;
    font-size: 11px;
    font-weight: 800;
    text-align: center;
}

.mindmap-connections-list {
    display: grid;
    gap: 7px;
}

.mindmap-connection-row {
    display: grid;
    grid-template-columns: 22px minmax(0, 1fr) auto;
    align-items: center;
    gap: 7px;
    padding: 8px;
    border: 1px solid #dbe3eb;
    border-radius: 8px;
    background: #fff;
}

.mindmap-connection-row.hierarchy {
    background: #f6f8fa;
}

.mindmap-connection-row.manual {
    border-color: #e1bd78;
    background: #fffaf0;
}

.mindmap-connection-row strong,
.mindmap-connection-row small {
    display: block;
    overflow-wrap: anywhere;
}

.mindmap-connection-row strong {
    font-size: 12px;
    line-height: 1.25;
    color: #173f65;
}

.mindmap-connection-row small {
    margin-top: 2px;
    font-size: 10px;
    color: #6b7785;
}

.mindmap-connection-lock,
.mindmap-connection-dot {
    text-align: center;
    font-size: 14px;
}

.mindmap-connection-delete {
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid #d5a7a7;
    border-radius: 6px;
    background: #fff;
    color: #9f2424;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}

.mindmap-connection-delete:hover {
    background: #fff0f0;
}

.mindmap-add-connection-button {
    width: 100%;
    margin-top: 10px;
    padding: 9px 10px;
    border: 1px solid #b97915;
    border-radius: 8px;
    background: #b97915;
    color: #fff;
    font-weight: 800;
    cursor: pointer;
}

.mindmap-connection-picker {
    margin-top: 10px;
    padding: 10px;
    border: 1px solid #d6c6a7;
    border-radius: 9px;
    background: #fffdf8;
}

.mindmap-connection-picker label {
    display: grid;
    gap: 5px;
    font-size: 11px;
    font-weight: 800;
    color: #173f65;
}

.mindmap-connection-picker input {
    width: 100%;
    min-width: 0;
    padding: 8px;
    border: 1px solid #bdcad7;
    border-radius: 7px;
}

.mindmap-connection-results {
    display: grid;
    gap: 5px;
    max-height: 230px;
    margin-top: 8px;
    overflow-y: auto;
}

.mindmap-picker-result {
    display: grid;
    grid-template-columns: 22px minmax(0, 1fr);
    gap: 6px;
    width: 100%;
    padding: 7px;
    border: 1px solid #dbe3eb;
    border-radius: 7px;
    background: #fff;
    text-align: left;
    cursor: pointer;
}

.mindmap-picker-result:hover {
    border-color: #b97915;
    background: #fff8e8;
}

.mindmap-picker-result strong,
.mindmap-picker-result small {
    display: block;
}

.mindmap-picker-result strong {
    color: #173f65;
    font-size: 11px;
}

.mindmap-picker-result small {
    color: #6b7785;
    font-size: 9px;
}

.mindmap-picker-cancel {
    margin-top: 8px;
    padding: 6px 9px;
    border: 1px solid #bdcad7;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
}

.mindmap-no-connections {
    margin: 4px 0;
    color: #778493;
    font-size: 11px;
}

.mindmap-visibility-badge {
    margin-left: auto;
    padding: 2px 7px;
    border-radius: 999px;
    font-size: 9px;
    font-weight: 900;
    text-transform: uppercase;
}

.mindmap-visibility-badge.public {
    background: #e8f5e8;
    color: #246b2b;
}

.mindmap-visibility-badge.private {
    background: #f4e8e8;
    color: #8c2d2d;
}

/* ==========================================================
   Mind Map v6 - Selected Node editor
   ========================================================== */
.mindmap-node-editor {
    margin: 14px 0;
    padding: 13px;
    border: 1px solid #dccb9f;
    border-radius: 10px;
    background: #fffaf0;
}

.mindmap-node-editor-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.mindmap-node-editor-heading h3 {
    margin: 0;
    font-size: 15px;
    color: #173f65;
}

.mindmap-node-editor-heading small {
    font-size: 10px;
    color: #6d7580;
    text-align: right;
}

.mindmap-edit-label {
    display: block;
    margin-bottom: 5px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: #5c6773;
}

.mindmap-name-edit-row {
    display: flex;
    flex-direction: column;
    gap: 7px;
    margin-bottom: 12px;
}

.mindmap-name-edit-row input {
    min-width: 0;
    width: 100%;
    padding: 8px 9px;
    border: 1px solid #b8c6d5;
    border-radius: 7px;
    background: #fff;
    color: #102f4c;
    font: inherit;
    font-size: 12px;
}

.mindmap-name-edit-row input:focus {
    outline: 2px solid rgba(23, 63, 101, .18);
    border-color: #173f65;
}

.mindmap-editor-save {
    width: 100%;
    border: 1px solid #173f65;
    border-radius: 7px;
    padding: 8px 10px;
    background: #173f65;
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    cursor: pointer;
}

.mindmap-editor-save:disabled,
.mindmap-visibility-choice:disabled {
    opacity: .55;
    cursor: wait;
}

.mindmap-visibility-toggle {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.mindmap-visibility-choice {
    border: 1px solid #bdc9d5;
    border-radius: 8px;
    padding: 8px 7px;
    background: #fff;
    color: #173f65;
    font-size: 11px;
    font-weight: 800;
    cursor: pointer;
}

.mindmap-visibility-choice.active[data-visibility="public"] {
    border-color: #2d8a47;
    background: #e9f6ed;
    color: #216837;
}

.mindmap-visibility-choice.active[data-visibility="private"] {
    border-color: #9b6219;
    background: #fff1da;
    color: #7a4a0c;
}

.mindmap-editor-help {
    margin: 7px 0 0;
    font-size: 10px;
    line-height: 1.35;
    color: #69737e;
}

.mindmap-node-edit-status {
    min-height: 15px;
    margin-top: 7px;
    font-size: 10px;
    font-weight: 700;
}

.mindmap-node-edit-status.saving { color: #96610c; }
.mindmap-node-edit-status.success { color: #24743a; }
.mindmap-node-edit-status.error { color: #a32626; }
.mindmap-node-edit-status.muted { color: #69737e; }


/* v11 - project-wide connection manager */
.mindmap-connections-button {
    border-color: #8b6b25 !important;
    background: #fff8e6 !important;
    color: #704e0e !important;
}

body.mindmap-modal-open { overflow: hidden; }
.mindmap-connection-manager {
    position: fixed; inset: 0; z-index: 20000; display: grid; place-items: center;
    padding: 28px; background: rgba(20, 31, 41, .58); backdrop-filter: blur(2px);
}
.mindmap-connection-manager.hidden { display: none; }
.mindmap-connection-manager-card {
    width: min(1050px, 96vw); max-height: 90vh; overflow: hidden;
    display: grid; grid-template-rows: auto auto auto auto minmax(160px, 1fr) auto;
    border: 1px solid #d4c49a; border-radius: 18px; background: #fffdf8;
    box-shadow: 0 24px 70px rgba(0,0,0,.28);
}
.mindmap-manager-header { display:flex; gap:20px; justify-content:space-between; padding:22px 24px 16px; border-bottom:1px solid #e5ddca; }
.mindmap-manager-header h2 { margin:3px 0 5px; color:#173f65; }
.mindmap-manager-header p:last-child { margin:0; color:#5f7282; }
.mindmap-manager-close { width:38px; height:38px; border:1px solid #cbd5dd; border-radius:9px; background:#fff; font-size:24px; cursor:pointer; }
.mindmap-manager-builder { display:grid; grid-template-columns:1fr 52px 1fr; gap:12px; align-items:start; padding:18px 24px 12px; }
.mindmap-manager-endpoint { position:relative; }
.mindmap-manager-endpoint label { display:block; margin-bottom:6px; color:#294961; font-size:.76rem; font-weight:900; text-transform:uppercase; letter-spacing:.05em; }
.mindmap-manager-endpoint input, .mindmap-manager-existing-header input { width:100%; box-sizing:border-box; min-height:42px; padding:0 11px; border:1px solid #c9d4dc; border-radius:9px; background:#fff; font:inherit; }
.mindmap-manager-direction { display:grid; place-items:center; padding-top:30px; color:#bd8427; font-size:30px; font-weight:900; }
.mindmap-manager-results { position:absolute; z-index:3; left:0; right:0; top:69px; max-height:260px; overflow:auto; border:1px solid #cbd5dd; border-radius:10px; background:#fff; box-shadow:0 12px 28px rgba(0,0,0,.15); }
.mindmap-manager-results.hidden { display:none; }
.mindmap-manager-result { width:100%; display:flex; gap:9px; align-items:flex-start; padding:9px 11px; border:0; border-bottom:1px solid #edf0f2; background:#fff; text-align:left; cursor:pointer; }
.mindmap-manager-result:hover { background:#fff8e6; }
.mindmap-manager-result strong, .mindmap-manager-result small { display:block; }
.mindmap-manager-result small { margin-top:2px; color:#6b7c89; }
.mindmap-manager-selection { margin-top:8px; min-height:48px; padding:8px 10px; border:1px solid #d8c58e; border-radius:9px; background:#fff8e6; }
.mindmap-manager-selection.empty { display:grid; place-items:center; border-style:dashed; color:#7d8790; background:#fafafa; }
.mindmap-manager-selection strong, .mindmap-manager-selection small { display:block; }
.mindmap-manager-selection small { margin-top:2px; color:#6b7c89; }
.mindmap-manager-add-row { display:flex; align-items:center; gap:14px; padding:0 24px 18px; }
.mindmap-manager-add { min-height:42px; padding:0 16px; border:1px solid #8b611d; border-radius:9px; background:#ad7420; color:#fff; font-weight:900; cursor:pointer; }
.mindmap-manager-add:disabled { opacity:.45; cursor:not-allowed; }
#mindmapManagerStatus { color:#5f7282; font-size:.86rem; }
.mindmap-manager-existing-header { display:flex; align-items:center; justify-content:space-between; gap:16px; padding:13px 24px; border-top:1px solid #e5ddca; border-bottom:1px solid #e5ddca; background:#fbf7ed; }
.mindmap-manager-existing-header > div { display:flex; align-items:baseline; gap:10px; }
.mindmap-manager-existing-header h3 { margin:0; color:#173f65; }
.mindmap-manager-existing-header span { color:#6b7c89; font-size:.82rem; }
.mindmap-manager-existing-header input { width:min(330px, 45%); }
.mindmap-manager-connection-list { overflow:auto; padding:8px 24px 16px; }
.mindmap-manager-connection-row { display:grid; grid-template-columns:minmax(0,1fr) 34px minmax(0,1fr) 76px 34px; gap:8px; align-items:center; padding:9px 4px; border-bottom:1px solid #ece6d8; }
.mindmap-manager-node strong, .mindmap-manager-node small { display:block; }
.mindmap-manager-node small { margin-top:2px; color:#74838e; font-size:.72rem; }
.mindmap-manager-arrow { text-align:center; color:#bd8427; font-size:20px; font-weight:900; }
.mindmap-manager-source { color:#8c6a25; font-size:.7rem; font-weight:800; text-transform:uppercase; }
.mindmap-manager-delete { width:30px; height:30px; border:1px solid #e0b3aa; border-radius:7px; background:#fff; color:#a63b2d; font-weight:900; cursor:pointer; }
.mindmap-manager-empty { color:#6b7c89; text-align:center; padding:30px; }
.mindmap-manager-footer { display:flex; justify-content:space-between; align-items:center; gap:16px; padding:13px 24px; border-top:1px solid #e5ddca; background:#fbf7ed; color:#687a87; font-size:.8rem; }
.mindmap-manager-footer button { min-height:38px; padding:0 14px; border:1px solid #c9d4dc; border-radius:8px; background:#fff; font-weight:800; cursor:pointer; }
@media (max-width: 760px) {
    .mindmap-connection-manager { padding:10px; }
    .mindmap-manager-builder { grid-template-columns:1fr; }
    .mindmap-manager-direction { padding:0; transform:rotate(90deg); }
    .mindmap-manager-connection-row { grid-template-columns:1fr 24px 1fr 30px; }
    .mindmap-manager-source { display:none; }
}


/* v12: Summary cards display an honest loading state until API calculations finish. */
.mindmap-summary article.is-calculating strong {
    font-size: 0.82rem;
    line-height: 1.15;
    letter-spacing: 0.01em;
}
.mindmap-summary-loader {
    display: none;
    position: relative;
    width: min(105px, 100%);
    height: 4px;
    margin-top: 7px;
    overflow: hidden;
    border-radius: 999px;
    background: #e4e9ed;
}
.mindmap-summary article.is-calculating .mindmap-summary-loader { display: block; }
.mindmap-summary-loader::after {
    content: "";
    position: absolute;
    inset: 0 auto 0 -38%;
    width: 38%;
    border-radius: inherit;
    background: #b87917;
    animation: mindmapSummaryLoading 1.05s ease-in-out infinite;
}
@keyframes mindmapSummaryLoading {
    0% { left: -38%; }
    100% { left: 100%; }
}

/* v14 loading-time estimate */
.mindmap-loading-eta {
  display: block;
  margin-top: 6px;
  font-size: 13px;
  font-weight: 700;
  color: #66788a;
}

/* ===== v16 connected-node visibility controls ===== */
.mindmap-connections-help {
    margin: -2px 0 10px;
    font-size: 10px;
    line-height: 1.35;
    color: #6b7785;
}

.mindmap-connection-actions {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 5px;
    flex-wrap: wrap;
}

.mindmap-connection-visibility {
    min-width: 70px;
    padding: 5px 7px;
    border: 1px solid #b8c7d4;
    border-radius: 999px;
    background: #fff;
    color: #173f65;
    font-size: 10px;
    font-weight: 800;
    cursor: pointer;
    white-space: nowrap;
}

.mindmap-connection-visibility.public {
    border-color: #43a665;
    background: #eefaf2;
    color: #176b35;
}

.mindmap-connection-visibility.private {
    border-color: #d0b37b;
    background: #fff8e8;
    color: #7b5514;
}

.mindmap-connection-visibility:hover:not(:disabled) {
    transform: translateY(-1px);
}

.mindmap-connection-visibility:disabled {
    opacity: .65;
    cursor: wait;
}


/* v17: no visible build/version tile in the toolbar. */
.mindmap-build-badge,
#mindmapV5ServerMarker {
    display: none !important;
}


/* v18: simplified toolbar - search on left, remaining actions on right. */
.mindmap-toolbar-actions {
    justify-content: flex-end;
    flex-wrap: nowrap;
}


/* v19: filters, Fit, and Reset View are intentionally removed. */
.mindmap-type-filters,
button[onclick="fitMindMap()"],
button[onclick="resetMindMapView()"] {
    display: none !important;
}


/* v20: search and filter controls are intentionally absent. */
.mindmap-search,
.mindmap-type-filters,
button[onclick="fitMindMap()"],
button[onclick="resetMindMapView()"] {
    display: none !important;
}

.mindmap-toolbar-actions {
    margin-left: auto;
    justify-content: flex-end;
}


/* v21: public Mind Map is read-only. Only Fullscreen remains in the toolbar. */
.mindmap-page[data-personal="false"] #mindmapMakeConnectionsButton,
.mindmap-page[data-personal="false"] .mindmap-save-button {
    display: none !important;
}

.mindmap-page[data-personal="false"] #mindmapNetwork {
    cursor: grab;
}

.mindmap-page[data-personal="false"] #mindmapNetwork.node-hovering {
    cursor: pointer;
}

.mindmap-public-tip {
    margin-top: 10px;
    padding: 9px 10px;
    border-radius: 8px;
    background: #f7f7f7;
    color: #52606d;
    font-size: 12px;
    line-height: 1.45;
}


/* ==========================================================================
   v28 - Manage Relationships: Connections + Shared Locations
   ========================================================================== */

.mindmap-relationship-manager-card {
    width: min(1180px, calc(100vw - 36px));
    max-height: min(900px, calc(100vh - 36px));
}

.mindmap-relationship-tabs {
    display: flex;
    gap: 8px;
    padding: 0 20px 14px;
    border-bottom: 1px solid #e3d9c5;
}

.mindmap-relationship-tab {
    min-width: 170px;
    padding: 10px 14px;
    border: 1px solid #d8c8aa;
    border-radius: 9px;
    background: #fff;
    color: #38434d;
    font-weight: 800;
    cursor: pointer;
}

.mindmap-relationship-tab.active {
    border-color: #a77118;
    background: #fff5d9;
    color: #704a00;
    box-shadow: inset 0 -3px 0 #c88819;
}

.mindmap-relationship-panel {
    padding: 18px 20px;
    overflow: visible;
}

.mindmap-manager-section-intro {
    margin-bottom: 16px;
}

.mindmap-manager-section-intro h3 {
    margin: 0 0 4px;
    font-size: 18px;
}

.mindmap-manager-section-intro p {
    margin: 0;
    color: #65717b;
}

.mindmap-alias-builder {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 44px minmax(0, 1fr);
    align-items: start;
    gap: 14px;
    padding: 16px;
    border: 1px solid #e0d4bd;
    border-radius: 12px;
    background: #fffdf8;
}

.mindmap-alias-column {
    position: relative;
    display: grid;
    gap: 8px;
    min-width: 0;
}

.mindmap-alias-column label {
    margin-top: 6px;
    font-size: 12px;
    font-weight: 800;
    color: #4b5660;
}

.mindmap-alias-column input,
.mindmap-alias-column select {
    width: 100%;
    box-sizing: border-box;
    min-height: 42px;
    padding: 9px 11px;
    border: 1px solid #cfc2aa;
    border-radius: 8px;
    background: #fff;
}

.mindmap-alias-column-heading {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 4px;
}

.mindmap-alias-column-heading > div {
    display: grid;
    gap: 2px;
}

.mindmap-alias-column-heading small {
    color: #6a747d;
}

.mindmap-alias-step {
    display: inline-grid;
    place-items: center;
    flex: 0 0 30px;
    width: 30px;
    height: 30px;
    border-radius: 999px;
    background: #173f65;
    color: #fff;
    font-weight: 900;
}

.mindmap-alias-direction {
    align-self: center;
    font-size: 28px;
    color: #b87912;
}

.mindmap-alias-selection {
    min-height: 52px;
    padding: 9px 11px;
    border: 1px solid #d8c8aa;
    border-radius: 8px;
    background: #fff;
    display: grid;
    gap: 2px;
}

.mindmap-alias-selection.empty {
    color: #7d858c;
    background: #f7f5f0;
}

.mindmap-alias-selection strong,
.mindmap-alias-selection small {
    overflow-wrap: anywhere;
}

.mindmap-alias-selection small {
    color: #69747d;
}

.mindmap-alias-cancel-edit {
    padding: 9px 13px;
    border: 1px solid #c9c1b4;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
}

.mindmap-alias-list {
    display: grid;
    gap: 11px;
    max-height: 360px;
    overflow: auto;
    padding-right: 4px;
}

.mindmap-alias-card {
    padding: 13px 14px;
    border: 1px solid #ded4c2;
    border-radius: 11px;
    background: #fff;
}

.mindmap-alias-card-heading {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 11px;
}

.mindmap-alias-card-heading h4 {
    margin: 3px 0 0;
    font-size: 15px;
}

.mindmap-alias-card-type {
    color: #8a5b00;
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.mindmap-alias-visibility {
    flex: 0 0 auto;
    padding: 5px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
}

.mindmap-alias-visibility.public {
    background: #ebf7ee;
    color: #27663b;
}

.mindmap-alias-visibility.private {
    background: #f2f0f6;
    color: #5d4c78;
}

.mindmap-alias-path-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 30px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
}

.mindmap-alias-path-grid > div {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.mindmap-alias-path-grid small {
    color: #727b83;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.mindmap-alias-path-grid strong {
    font-size: 12px;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.mindmap-alias-path-arrow {
    text-align: center;
    color: #b87912;
    font-size: 20px;
}

.mindmap-alias-actions {
    display: flex;
    justify-content: flex-end;
    gap: 7px;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid #eee7dc;
}

.mindmap-alias-actions button {
    padding: 7px 10px;
    border-radius: 7px;
    border: 1px solid #cfc5b4;
    background: #fff;
    cursor: pointer;
    font-weight: 700;
}

.mindmap-alias-actions .mindmap-alias-delete {
    border-color: #dfb6b6;
    color: #a92f2f;
}

.mindmap-shared-node-callout {
    display: grid;
    gap: 5px;
    margin: 10px 0 12px;
    padding: 10px;
    border: 1px solid #e0bd6a;
    border-radius: 9px;
    background: #fff8e5;
    color: #624500;
    font-size: 12px;
}

.mindmap-shared-node-callout > span {
    color: #806b45;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.mindmap-shared-node-callout button {
    justify-self: start;
    margin-top: 4px;
    padding: 7px 9px;
    border: 1px solid #caa65a;
    border-radius: 7px;
    background: #fff;
    color: #6e4c00;
    cursor: pointer;
    font-weight: 800;
}

@media (max-width: 760px) {
    .mindmap-relationship-manager-card {
        width: calc(100vw - 16px);
        max-height: calc(100vh - 16px);
    }

    .mindmap-relationship-tabs {
        padding-inline: 12px;
    }

    .mindmap-relationship-tab {
        flex: 1 1 0;
        min-width: 0;
        padding-inline: 8px;
    }

    .mindmap-relationship-panel {
        padding: 14px 12px;
    }

    .mindmap-alias-builder {
        grid-template-columns: 1fr;
    }

    .mindmap-alias-direction {
        transform: rotate(90deg);
        justify-self: center;
    }

    .mindmap-alias-path-grid {
        grid-template-columns: 1fr;
    }

    .mindmap-alias-path-arrow {
        transform: rotate(90deg);
    }

    .mindmap-alias-actions {
        flex-wrap: wrap;
        justify-content: stretch;
    }

    .mindmap-alias-actions button {
        flex: 1 1 auto;
    }
}


/* ==========================================================================
   v28.1 - Relationship manager scrolling fix
   The original v11 modal used a six-row grid. v28 replaced the interior with
   tab panels, so the old grid clipped the Existing Connections / Alias lists.
   ========================================================================== */

.mindmap-relationship-manager-card {
    display: grid !important;
    grid-template-rows: auto auto minmax(0, 1fr) auto !important;
    overflow: hidden !important;
    min-height: 0;
}

.mindmap-relationship-panel {
    min-height: 0;
    overflow-y: auto !important;
    overflow-x: hidden;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
}

#mindmapRelationshipsConnectionsTab,
#mindmapRelationshipsAliasesTab {
    min-height: 0;
}

#mindmapRelationshipsConnectionsTab:not(.hidden),
#mindmapRelationshipsAliasesTab:not(.hidden) {
    display: block;
}

.mindmap-manager-connection-list {
    max-height: 420px;
    overflow-y: auto !important;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
}

.mindmap-alias-list {
    max-height: 420px;
    overflow-y: auto !important;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
}

/* Keep the modal header, tabs, and footer stationary while the active tab scrolls. */
.mindmap-manager-header,
.mindmap-relationship-tabs,
.mindmap-manager-footer {
    position: relative;
    z-index: 2;
    flex-shrink: 0;
}

@media (max-height: 760px) {
    .mindmap-relationship-manager-card {
        max-height: calc(100vh - 16px) !important;
    }

    .mindmap-manager-connection-list,
    .mindmap-alias-list {
        max-height: 300px;
    }
}


/* v28.4 - Overlapping Ideas + always-visible close button */
.mindmap-manager-close {
    border-color: #8b611d !important;
    background: #ad7420 !important;
    color: #ffffff !important;
    font-weight: 900;
}
.mindmap-manager-close:hover,
.mindmap-manager-close:focus-visible {
    border-color: #754d12 !important;
    background: #8f5d10 !important;
    color: #ffffff !important;
}


/* ==========================================================================
   v28.5 - Readable relationship buttons + Overlap Link builder
   ========================================================================== */

/* The earlier global button rules made Edit / Make Public / Close appear blank. */
.mindmap-alias-actions button,
.mindmap-secondary-action,
.mindmap-manager-footer button,
.mindmap-alias-cancel-edit {
    color: #173f65 !important;
    background: #fffaf0 !important;
    border-color: #c9b88f !important;
    opacity: 1 !important;
    -webkit-text-fill-color: currentColor !important;
}

.mindmap-alias-actions button:hover,
.mindmap-secondary-action:hover,
.mindmap-manager-footer button:hover,
.mindmap-alias-cancel-edit:hover {
    color: #5d3b00 !important;
    background: #f5e4bd !important;
    border-color: #b77a16 !important;
}

.mindmap-alias-actions .mindmap-alias-delete,
.mindmap-overlap-delete {
    color: #a92f2f !important;
    background: #fff9f7 !important;
    border-color: #dfa9a3 !important;
}

.mindmap-alias-actions .mindmap-alias-delete:hover,
.mindmap-overlap-delete:hover {
    color: #7e1515 !important;
    background: #fde8e5 !important;
    border-color: #c97870 !important;
}

.mindmap-manager-footer button {
    min-width: 78px;
    font-weight: 800;
}

/* Keep the top-right X permanently in the dark brown theme. */
.mindmap-manager-close {
    color: #fff !important;
    background: #b67816 !important;
    border-color: #9a620e !important;
    -webkit-text-fill-color: #fff !important;
}

.mindmap-overlap-link-builder {
    margin: 20px 0 18px;
    padding: 16px;
    border: 1px solid #dfd0b2;
    border-radius: 12px;
    background: #fffdf8;
}

.mindmap-overlap-link-builder .mindmap-manager-section-intro {
    margin-bottom: 14px;
}

.mindmap-overlap-create-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 12px;
}

.mindmap-overlap-create-row label {
    font-size: 12px;
    font-weight: 800;
    color: #4b5660;
}

.mindmap-overlap-create-row select {
    min-height: 40px;
    padding: 8px 10px;
    border: 1px solid #cfc2aa;
    border-radius: 8px;
    background: #fff;
}

.mindmap-overlap-card {
    border-left: 4px solid #b67816;
}

@media (max-width: 760px) {
    .mindmap-overlap-create-row {
        align-items: stretch;
    }

    .mindmap-overlap-create-row select,
    .mindmap-overlap-create-row button {
        width: 100%;
    }
}
