.split-pane {
    display: grid;
    flex: 1 1 0;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
    gap: 1rem;
    min-height: 0;
    align-items: stretch;
    overflow: hidden;
}

@media (width < 48rem) {
    .split-pane {
        grid-template-columns: 1fr;
        grid-template-rows: minmax(0, 1fr) auto minmax(0, 1fr);
    }

    .controls-column {
        order: 2;
        width: 100%;
    }

    .split-pane-col:first-child {
        order: 1;
    }

    .split-pane-col:last-child {
        order: 3;
    }

    .code-fill {
        min-height: 14rem;
    }
}

.tool-option {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    width: 100%;
    padding: 0.625rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    background: var(--surface);
}

.tool-option-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
}

.tool-option-input {
    width: 100%;
    min-width: 0;
    padding: 0.5rem 0.625rem;
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    background: var(--surface-muted);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.8125rem;
}

.tool-option-input:focus,
.tool-option-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgb(37 99 235 / 0.15);
}

.tool-option-select {
    width: 100%;
    min-width: 0;
    padding: 0.5rem 0.625rem;
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    background: var(--surface-muted);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    cursor: pointer;
}

.jsonpath-expression-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 0.75rem;
    border-bottom: 1px solid var(--border);
    background: var(--surface-muted);
    flex-shrink: 0;
}

.jsonpath-expression-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    flex-shrink: 0;
}

.jsonpath-expression-input {
    flex: 1 1 12rem;
    min-width: 0;
    padding: 0.5rem 0.625rem;
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    background: var(--surface);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.8125rem;
}

.jsonpath-expression-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgb(37 99 235 / 0.15);
}

.jsonpath-expression-select {
    flex: 0 1 auto;
    min-width: 7rem;
    max-width: 100%;
    padding: 0.5rem 0.625rem;
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    background: var(--surface);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.75rem;
    cursor: pointer;
}

.jsonpath-expression-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgb(37 99 235 / 0.15);
}

.json-panel--jsonpath .code-editor,
.json-panel--jsonpath > .code-output {
    border-top: none;
}

.json-panel-stack {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    flex: 1 1 0;
    min-height: 0;
    min-width: 0;
}

.json-panel-stack > .json-panel {
    flex: 1 1 0;
    min-height: 0;
}

/* Upload modal */
.upload-modal {
    position: fixed;
    inset: 0;
    z-index: 300;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.upload-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgb(15 23 42 / 0.45);
}

.upload-modal-panel {
    position: relative;
    z-index: 1;
    width: min(28rem, 100%);
    border: 1px solid var(--card-border);
    border-radius: 0.875rem;
    background: var(--card-bg);
    box-shadow: 0 20px 40px rgb(15 23 42 / 0.18);
}

.upload-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.125rem;
    border-bottom: 1px solid var(--card-border);
}

.upload-modal-title {
    margin: 0;
    font-size: 1.0625rem;
    font-weight: 600;
    color: var(--text-primary);
}

.upload-modal-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 0.5rem;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}

.upload-modal-close:hover {
    background: var(--btn-blue-soft);
    border-color: var(--btn-blue-border);
    color: var(--primary);
}

.upload-modal-body {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1.125rem;
}

.upload-section-title {
    margin: 0 0 0.25rem;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
}

.upload-section-desc {
    margin: 0 0 0.75rem;
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.upload-file-label {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.625rem;
    cursor: pointer;
}

.upload-file-input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.upload-file-name {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.upload-modal-divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.upload-modal-divider::before,
.upload-modal-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--card-border);
}

.upload-url-row {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
}

.upload-url-input {
    width: 100%;
    padding: 0.625rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    background: var(--surface-muted);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.875rem;
}

.upload-url-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgb(37 99 235 / 0.15);
}

@media (width >= 30rem) {
    .upload-url-row {
        flex-direction: row;
        align-items: stretch;
    }

    .upload-url-input {
        flex: 1;
        min-width: 0;
    }

    .upload-url-row .btn {
        flex-shrink: 0;
    }
}
