.mmt-tool-panel {
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    overflow: hidden;
    min-height: 540px;
}

/* ── Toolbar ─────────────────────────────────── */
.mmt-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-muted, #f9fafb);
    flex-shrink: 0;
}

.mmt-toolbar-left { display: flex; align-items: center; gap: 8px; }

.mmt-title {
    font-size: 0.9rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.mmt-title i { color: #6366f1; }

.mmt-badge {
    font-size: 0.68rem;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 10px;
    background: rgba(99, 102, 241, 0.1);
    color: #6366f1;
}

.mmt-toolbar-right { display: flex; gap: 6px; align-items: center; }

.mmt-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 10px;
    font-size: 0.78rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    cursor: pointer;
    transition: background 0.15s;
}

.mmt-btn:hover { background: var(--bg-muted); }

.mmt-btn-primary {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border-color: transparent;
    color: #fff !important;
}

.mmt-btn-primary:hover { opacity: 0.9; }

/* ── Canvas ──────────────────────────────────── */
.mmt-canvas-wrap {
    flex: 1;
    padding: 32px 24px;
    overflow: auto;
    background: #f8fafc;
}

.mmt-board {
    position: relative;
    max-width: 820px;
    margin: 0 auto;
    min-height: 480px;
}

/* SVG overlay for trunk + connector lines */
.mmt-lines {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

/* ── Root node ───────────────────────────────── */
.mmt-root-row {
    display: flex;
    justify-content: center;
    padding-bottom: 4px;
    position: relative;
    z-index: 1;
}

.mmt-root-node {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.mmt-root-circle {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f97316, #fb923c);
    box-shadow: 0 6px 20px rgba(249, 115, 22, 0.38);
    flex-shrink: 0;
}

.mmt-root-label {
    text-align: center;
}

.mmt-root-label .mmt-node-title {
    font-size: 1rem;
    font-weight: 700;
}

.mmt-root-label .mmt-node-sub {
    font-size: 0.82rem;
}

/* ── Branch rows ─────────────────────────────── */
.mmt-rows {
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1;
}

.mmt-row {
    display: flex;
    align-items: center;
    min-height: 96px;
}

.mmt-half {
    flex: 1;
    display: flex;
    align-items: center;
}

.mmt-half-left {
    justify-content: flex-end;
    padding-right: 36px;
}

.mmt-half-right {
    justify-content: flex-start;
    padding-left: 36px;
}

/* ── Node = circle + label ───────────────────── */
.mmt-node {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* left side: label → circle (circle nearest trunk) */
.mmt-half-left .mmt-node {
    flex-direction: row;
}

/* right side: circle → label (circle nearest trunk) */
.mmt-half-right .mmt-node {
    flex-direction: row;
}

.mmt-circle {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    flex-shrink: 0;
    background-color: #6366f1;
}

/* ── Labels ──────────────────────────────────── */
.mmt-label-wrap {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.mmt-label-left { text-align: right; }
.mmt-label-right { text-align: left; }

.mmt-node-title {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-primary, #0f172a);
    line-height: 1.3;
    min-width: 48px;
    border-radius: 2px;
}

.mmt-node-sub {
    font-size: 0.74rem;
    color: var(--text-secondary, #64748b);
    line-height: 1.5;
    letter-spacing: 0.01em;
    max-width: 220px;
    border-radius: 2px;
}

/* ── Focus styles ────────────────────────────── */
[contenteditable]:focus { outline: none; }

.mmt-node-title:focus {
    background: rgba(99, 102, 241, 0.06);
    box-shadow: 0 1px 0 #6366f1;
}

.mmt-node-sub:focus {
    background: rgba(99, 102, 241, 0.04);
    box-shadow: 0 1px 0 #a5b4fc;
}

/* ── Footer hint ─────────────────────────────── */
/* ── Responsive ──────────────────────────────── */
@media (max-width: 640px) {
    .mmt-half-left { padding-right: 20px; }
    .mmt-half-right { padding-left: 20px; }
    .mmt-circle { width: 26px; height: 26px; }
    .mmt-root-circle { width: 42px; height: 42px; }
    .mmt-node-sub { max-width: 130px; font-size: 0.7rem; }
    .mmt-node-title { font-size: 0.82rem; }
}
