/* ── MODALS ── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 500;
    backdrop-filter: blur(2px);
}

.modal {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 360px;
    max-width: 90vw;
    overflow: hidden;
    animation: modal-in 0.15s ease;
}

@keyframes modal-in {
    from {
        transform: scale(0.95) translateY(8px);
        opacity: 0;
    }

    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: 15px;
}

.modal-close {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    color: var(--text3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    transition: all 0.1s;
}

.modal-close:hover {
    background: var(--surface2);
    color: var(--text);
}

.modal-body {
    padding: 16px 20px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 20px;
    border-top: 1px solid var(--border);
}

.btn-primary {
    height: 34px;
    padding: 0 16px;
    background: var(--accent);
    color: white;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    transition: background 0.1s;
}

.btn-primary:hover {
    background: var(--accent-hover);
}

.btn-secondary {
    height: 34px;
    padding: 0 16px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text2);
    transition: all 0.1s;
}

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

/* Export modal */
.export-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.export-options label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .7px;
    color: var(--text3);
}

.export-format-grid,
.export-scale-grid {
    display: flex;
    gap: 6px;
}

.export-fmt,
.export-scale {
    flex: 1;
    height: 34px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 500;
    color: var(--text2);
    background: var(--bg);
    transition: all 0.1s;
}

.export-fmt:hover,
.export-scale:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.export-fmt.active,
.export-scale.active {
    border-color: var(--accent);
    background: var(--accent-light);
    color: var(--accent);
}

#export-scope {
    width: 100%;
    height: 34px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0 8px;
    font-size: 12px;
    background: var(--bg);
    color: var(--text);
    outline: none;
}

/* ── CONTEXT MENU ── */
#context-menu {
    position: fixed;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 400;
    min-width: 180px;
    padding: 4px;
    animation: ctx-in 0.1s ease;
}

@keyframes ctx-in {
    from {
        transform: scale(0.95);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.ctx-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 10px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 12px;
    color: var(--text);
    transition: background 0.08s;
}

.ctx-item:hover {
    background: var(--surface2);
}

.ctx-item[data-action="delete"] {
    color: var(--danger);
}

.ctx-item[data-action="delete"]:hover {
    background: #fff0f0;
}

.ctx-item span {
    color: var(--text3);
    font-size: 11px;
    font-family: var(--font-mono);
}

.ctx-sep {
    height: 1px;
    background: var(--border);
    margin: 3px 0;
}

/* Tooltip */
#tooltip {
    position: fixed;
    background: var(--text);
    color: white;
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 4px;
    pointer-events: none;
    z-index: 600;
    white-space: nowrap;
    opacity: 0.9;
}