/* Tree */
.tree-wrap {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    background: transparent;
}

.tree-wrap::-webkit-scrollbar { width: 6px; }
.tree-wrap::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.15);
    border-radius: 3px;
}

.tree-empty {
    text-align: center;
    padding: 50px 20px;
    color: var(--text-muted);
    font-size: 13px;
}

.tree-row {
    display: flex;
    align-items: center;
    padding: 7px 10px;
    border-radius: 8px;
    cursor: pointer;
    gap: 8px;
    margin-bottom: 2px;
    transition: all 0.12s;
    border: 1px solid transparent;
    text-shadow: 0 1px 4px rgba(0,0,0,0.7);
}

.tree-row:hover { background: rgba(255,255,255,0.06); }

.tree-row.selected {
    background: rgba(99, 102, 241, 0.25);
    border-color: rgba(99, 102, 241, 0.4);
}

.tree-row.hidden-part { opacity: 0.35; }

.tree-expand {
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    color: var(--text-muted);
    flex-shrink: 0;
    border-radius: 4px;
}

.tree-expand.can-expand:hover {
    background: rgba(255,255,255,0.1);
    color: var(--text);
}

.tree-icon { font-size: 15px; flex-shrink: 0; }

.tree-label {
    flex: 1;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tree-eye {
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 14px;
    flex-shrink: 0;
}

.tree-eye:hover {
    background: rgba(255,255,255,0.1);
    color: var(--text);
}

.tree-eye.is-hidden { color: var(--text-muted); }

/* Fit-to-view button next to the eye icon. Same dimensions and hover
   feedback as .tree-eye for visual consistency. */
.tree-fit {
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 14px;
    flex-shrink: 0;
}

.tree-fit:hover {
    background: rgba(255,255,255,0.1);
    color: var(--text);
}

.tree-color {
    width: 18px;
    height: 18px;
    border-radius: 5px;
    border: 2px solid rgba(255,255,255,0.15);
    flex-shrink: 0;
    cursor: pointer;
}

.tree-color:hover {
    transform: scale(1.15);
    border-color: rgba(255,255,255,0.4);
}

.tree-kids {
    margin-left: 20px;
    padding-left: 10px;
    border-left: 1px dashed rgba(255,255,255,0.1);
}

.tree-kids.shut { display: none; }

/* Info */
.info-section {
    padding: 16px;
    border-bottom: 1px solid var(--glass-border);
}

.info-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.info-row:last-child { margin-bottom: 0; }

.info-key { font-size: 12px; color: var(--text-muted); }
.info-val { font-size: 13px; font-weight: 500; }

.selection-box {
    margin: 16px;
    padding: 14px;
    background: rgba(99, 102, 241, 0.12);
    border: 1px solid rgba(99, 102, 241, 0.25);
    border-radius: 10px;
}

.selection-name {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
}

.selection-stats {
    font-size: 12px;
    color: var(--text-secondary);
}

.selection-detail {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid rgba(255,255,255,0.06);
    font-size: 12px;
}
.selection-detail .info-key { color: var(--text-muted); flex-shrink: 0; }
.selection-detail .info-val { color: var(--text-secondary); text-align: right; word-break: break-all; }

/* Volume / Surface Area refresh button — sits inside .info-val next to the
   computed value. Click triggers the calculation; ↻ spins while running. */
.selection-detail .info-val .calc-value {
    margin-right: 6px;
}
.selection-detail .info-val .calc-unit {
    color: var(--text-muted);
    font-size: 11px;
    margin-left: 2px;
}
.calc-refresh-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    padding: 0;
    border: 1px solid var(--glass-border);
    background: var(--glass-bg);
    color: var(--text-secondary);
    border-radius: 6px;
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
    vertical-align: middle;
    transition: background 0.15s, color 0.15s, transform 0.15s;
}
.calc-refresh-btn:hover {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}
.calc-refresh-btn.spinning {
    animation: calc-spin 0.8s linear infinite;
    pointer-events: none;
    opacity: 0.7;
}
@keyframes calc-spin { to { transform: rotate(360deg); } }

/* Light background text overrides */
.light-bg .tree-label { color: #1a1a2e; }
.light-bg .tree-expand { color: #333; }
.light-bg .tree-eye { color: #555; }
.light-bg .tree-row:hover { background: rgba(0,0,0,0.06); }
.light-bg .tree-row { text-shadow: 0 1px 4px rgba(255, 255, 255, 0.7); }
.light-bg .tree-row.selected { background: rgba(99,102,241,0.15); }
.light-bg .panel-head { border-color: rgba(0,0,0,0.1); }

/* Welcome screen */
.light-bg .welcome h2 { color: #1a1a2e; }
.light-bg .welcome p { color: #333; }
.light-bg .welcome .feat { color: #333; }
.light-bg .welcome-box { color: #333; }

/* Loading text */
.light-bg #loadingText { color: #1a1a2e; }
.light-bg .loading-dots { color: #333; }

/* Diff legend */
.light-bg .diff-legend-item { color: #1a1a2e; }

