.panel {
    display: flex;
    flex-direction: column;
    background: var(--color-surface);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);

    &--workflow { grid-area: workflow; }
    &--variables { grid-area: variables; }
    &--details { grid-area: details; }

    &__header {
        padding: var(--space-md);
        border-bottom: 1px solid var(--color-border);
        background: var(--color-surface);

        h3 {
            margin: 0;
            font-size: 1rem;
            font-weight: 600;
            color: var(--color-text-primary);
        }
    }

    &__content {
        flex: 1;
        overflow-y: auto;
        padding: var(--space-md);

        &::-webkit-scrollbar {
            width: 8px;
        }

        &::-webkit-scrollbar-track {
            background: transparent;
        }

        &::-webkit-scrollbar-thumb {
            background: var(--color-border);
            border-radius: 4px;
        }
    }
}

.variable {
    --variable-bg: transparent;
    --variable-color: var(--color-text-primary);

    display: inline-flex;
    align-items: center;
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-sm);
    font-family: ui-monospace, monospace;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--variable-bg);
    color: var(--variable-color);
    border: 1px solid transparent;

    &:hover {
        transform: translateY(-1px);
        box-shadow: var(--shadow-sm);
    }

    &--file {
        --variable-bg: rgba(59, 130, 246, 0.1);
        border-color: rgba(59, 130, 246, 0.2);
    }

    &--input {
        --variable-bg: rgba(16, 185, 129, 0.1);
        border-color: rgba(16, 185, 129, 0.2);
    }

    &--output {
        --variable-bg: rgba(245, 158, 11, 0.1);
        border-color: rgba(245, 158, 11, 0.2);
    }
}

.section-label,
h3.section-label {
    color: var(--color-text-secondary);
    font-size: 0.9em;
    font-weight: 500;
    padding: var(--space-sm) var(--space-md);
    margin: 0;
    align-items: center;
    gap: 0.5em;
    background: var(--color-surface);

    .variable-reference {
        font-weight: normal;
    }

    .category-count {
        font-weight: normal;
        display: inline-flex;
        margin-left: var(--space-xs);
    }

    &:first-child {
        margin-top: 0;
    }
}

.prompt-container,
.response-container {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--space-sm);
    overflow: hidden;
}

/* Unified list items */
.list-item {
    padding: var(--space-md);
    display: flex;
    align-items: center;
    gap: var(--space-md);
    cursor: pointer;
    transition: background-color 150ms cubic-bezier(0.4, 0, 0.2, 1);
    border-bottom: 1px solid var(--color-border);
    position: relative;
    min-height: 48px;

    &:last-child {
        border-bottom: none;
    }

    &:hover {
        background: rgba(0, 0, 0, 0.04);
    }

    &:active {
        background: rgba(0, 0, 0, 0.08);
    }

    /* nav active class removed in favor of progress bar + is-current */

    &__icon {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 24px;
        height: 24px;
        border-radius: 50%;
        background: var(--color-surface-secondary);
        color: var(--color-text-secondary);
    }

    &__title {
        flex: 1;
        font-size: 0.875rem;
        color: var(--color-text-primary);
        font-weight: 400;
        line-height: 1.5;
    }

    &__secondary {
        font-size: 0.75rem;
        color: var(--color-text-secondary);
        margin-top: 4px;
    }

    &__status {
        font-size: 0.75rem;
    }

    &--two-line {
        padding: var(--space-md);
        height: auto;
        min-height: 64px;

        .list-item__content {
            display: flex;
            flex-direction: column;
            flex: 1;
        }
    }
}

.step-status, .status-tag {
    font-size: var(--font-size-sm);
    font-weight: 100;
}

/* Unified status tag styling */
.status-tag {
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
    background: transparent;
    position: relative;
    overflow: hidden;
    color: transparent;

    /* Status icons for different states */
    &.initial {
        display: none;
    }

    &::before {
        font-family: 'Material Symbols Rounded';
        font-size: 18px;
        font-variation-settings: 'FILL' 0, 'wght' 300, 'GRAD' -25, 'opsz' 24;
        position: absolute;
        text-indent: 0;
    }

    &.pending::before {
        content: 'pause';
        color: #d4af37;
    }

    &.running::before {
        content: 'progress_activity';
        color: #4a9eff;
        animation: spin 2s linear infinite;
    }

    &.completed::before {
        content: 'done_all';
        color: #5fc871;
    }

    &.available::before {
        content: 'check';
        color: #5fc871;
    }

    &.error::before {
        content: 'warning';
        color: #ff3333;
    }

    &.stopped::before,
    &.stopping::before {
        content: 'dangerous';
        color: #ff3333;
    }

    &.editing::before {
        content: 'edit';
        color: #ff9933;
    }
}

/* Add spinning animation keyframes */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.metadata {
    margin-bottom: var(--space-md);
}

/* Add styles for input in editing state */
.variable-item[data-name="userInput"] {
    &.editing {
        background: var(--color-surface);
        border-color: var(--color-border);

        textarea {
            border-color: var(--color-border);

            &:focus {
                border-color: var(--color-brand-primary);
                box-shadow: 0 0 0 3px var(--color-brand-primary-15);
            }
        }
    }
}

/* Response container styles */
.response-container {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    padding: var(--space-md);
    margin-top: var(--space-md);
}

.response {
    margin: var(--space-sm) 0;
    padding: var(--space-md);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
}

/* Workflow title and back button styles */
.workflow-title {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.workflow-title h2 {
    margin: 0;
    padding: 0;
    font-size: 1.4em;
}

.back-button {
    font-size: 0.8em;
    color: var(--color-text-secondary);
    text-decoration: none;
    margin-top: 4px;
}

.back-button:hover {
    text-decoration: underline;
}

/* Step badge styling */
.step-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--color-brand-primary);
    color: var(--color-on-brand-primary);
    border-radius: 4px;
    font-size: var(--font-size-sm);
    font-weight: 500;
    min-width: 24px;
    height: 24px;
    padding: 0 var(--space-xs);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    text-align: center;
}

/* Status tag positioning in variable headers */
.nav-item .status-tag {
    margin-left: auto;
    width: 24px;
    height: 24px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

/* Code Blocks Styling */
.code-block {
    margin: 10px 0;
    border: 1px solid var(--color-border);
    border-radius: 5px;
    overflow: hidden;
    background-color: var(--color-surface-variant);
}

.code-block .code-header {
    background-color: var(--color-surface-secondary);
    padding: 5px 10px;
    font-family: monospace;
    color: var(--color-text-primary);
    font-weight: bold;
    border-bottom: 1px solid var(--color-border);
}

.code-block pre {
    margin: 0;
    padding: 10px;
    background-color: var(--color-surface-variant);
    overflow: auto;
}

.code-block code {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 14px;
    white-space: pre-wrap;
}

/* Inline code styling */
code {
    background-color: var(--color-surface-secondary);
    padding: 2px 4px;
    border-radius: 3px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.9em;
}

/* Variable value styling */
.variable-value {
    white-space: normal;
    word-break: break-word;
    overflow-y: auto;
    padding: var(--space-md);
    font-family: inherit;
    line-height: 1.5;
}

.variable-value h1,
.variable-value h2,
.variable-value h3,
.variable-value h4,
.variable-value h5,
.variable-value h6 {
    margin-top: 1.5em;
    margin-bottom: 0.5em;
    font-weight: 600;
    line-height: 1.25;
    color: var(--color-text-primary, #333);
}

.variable-value h1 {
    font-size: 1.6em;
    border-bottom: 1px solid var(--color-border);
    padding-bottom: 0.3em;
}

.variable-value h2 {
    font-size: 1.4em;
    border-bottom: 1px solid var(--color-border);
    padding-bottom: 0.3em;
}

.variable-value h3 {
    font-size: 1.2em;
}

.variable-value h4 {
    font-size: 1.1em;
}

.variable-value p {
    margin-top: 0;
    margin-bottom: 16px;
}

.variable-value ul,
.variable-value ol {
    padding-left: 2em;
    margin-top: 0;
    margin-bottom: 16px;
}

.variable-value ul ul,
.variable-value ol ol,
.variable-value ul ol,
.variable-value ol ul {
    margin-top: 0;
    margin-bottom: 0;
}

.variable-value li {
    margin-bottom: 0.25em;
}

.variable-value blockquote {
    margin-left: 0;
    padding: 0 1em;
    color: var(--color-text-secondary);
    border-left: 0.25em solid var(--color-border);
}

.variable-value a {
    color: var(--color-status-info);
    text-decoration: none;
}

.variable-value a:hover {
    text-decoration: underline;
}

.variable-value table {
    border-collapse: collapse;
    width: 100%;
    margin-bottom: 16px;
}

.variable-value table th,
.variable-value table td {
    padding: 6px 13px;
    border: 1px solid var(--color-border);
}

.variable-value table tr {
    background-color: var(--color-surface);
    border-top: 1px solid var(--color-border);
}

.variable-value table tr:nth-child(2n) {
    background-color: var(--color-surface-variant);
}

/* Remove placeholder styling */
.variable-value .placeholder {
    display: none;
}

/* Gherkin-specific styling */
.gherkin .code-header {
    background-color: var(--color-status-success-15);
    color: var(--color-status-success);
}

.gherkin pre {
    background-color: var(--color-status-success-15);
    color: var(--color-text-primary);
}

/* Response container styling */
.response-container {
    margin-bottom: 15px;
}

.response-metadata {
    margin-top: 10px;
    padding: 10px;
    background-color: var(--color-surface-variant);
    border: 1px solid var(--color-border);
    border-radius: 5px;
}

.metadata-item {
    margin-bottom: 5px;
    line-height: 1.4;
}

.metadata-item strong {
    font-weight: 600;
    color: var(--color-text-primary);
}

.metadata-item pre {
    margin: 5px 0 10px;
    padding: 8px;
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 3px;
}

/* Additional Gherkin feature specific styling */
.code-block.gherkin .keyword {
    font-weight: bold;
    color: var(--color-status-success);
}

.code-block.gherkin .step {
    color: var(--color-text-primary);
    margin-left: 20px;
}

.code-block.gherkin .scenario {
    margin-top: 15px;
    font-weight: 600;
    color: var(--color-status-info);
}

.variable-value pre {
    background-color: var(--color-surface-variant);
    padding: 10px;
    border: 1px solid var(--color-border);
    border-radius: 5px;
    overflow: auto;
    margin: 5px 0;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.45;
    white-space: pre-wrap;
}

/* Accordion/Collapsible sections */
.process-details.collapsed {
    display: none;
}

.settings-title .toggle-icon {
    transition: transform 0.2s;
}

.process-details.collapsed ~ h3 .toggle-icon,
.content-section:has(.process-details.collapsed) .toggle-icon {
    transform: rotate(-90deg);
}

.nav-segment--phases {
    display: flex;
    gap: 8px;
    align-items: center;
}

.phase-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: linear-gradient(135deg, var(--color-phase1, #4CAF50) 0%, color-mix(in srgb, var(--color-phase1, #4CAF50) 85%, black) 100%);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: relative;
}

.phase-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    color: white; /* Keep white text on hover */
}

.phase-btn:active:not(:disabled) {
    transform: translateY(0);
}

.unified-phase-btn {
    background: linear-gradient(135deg, var(--color-phase1, #4CAF50) 0%, color-mix(in srgb, var(--color-phase1, #4CAF50) 85%, black) 100%);
}

/* Preserve gradient and white text on hover */
.unified-phase-btn:hover {
    background: linear-gradient(135deg, var(--color-phase1, #4CAF50) 0%, color-mix(in srgb, var(--color-phase1, #4CAF50) 85%, black) 100%);
    color: white;
}

.unified-phase-btn[data-current-phase="1"] {
    background: linear-gradient(135deg, var(--color-phase1, #4CAF50) 0%, color-mix(in srgb, var(--color-phase1, #4CAF50) 85%, black) 100%);
}
.unified-phase-btn[data-current-phase="1"]:hover { color: white; }

.unified-phase-btn[data-current-phase="2"] {
    background: linear-gradient(135deg, var(--color-phase2, #2196F3) 0%, color-mix(in srgb, var(--color-phase2, #2196F3) 85%, black) 100%);
}
.unified-phase-btn[data-current-phase="2"]:hover { color: white; }

.unified-phase-btn[data-current-phase="3"] {
    background: linear-gradient(135deg, var(--color-phase3, #9C27B0) 0%, color-mix(in srgb, var(--color-phase3, #9C27B0) 85%, black) 100%);
}
.unified-phase-btn[data-current-phase="3"]:hover { color: white; }

.unified-phase-btn.ready {
    background: linear-gradient(135deg, var(--color-phase-ready, #10b981) 0%, color-mix(in srgb, var(--color-phase-ready, #10b981) 85%, black) 100%);
}
.unified-phase-btn.ready:hover { color: white; }

.unified-phase-btn.ready::after {
    content: '✓';
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--color-phase-ready, #059669);
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.phase-prefix {
    font-weight: 400;
    opacity: 0.9;
}

.phase-text {
    font-weight: 600;
}

.phase-status {
    background: rgba(255, 255, 255, 0.25);
    padding: 2px 6px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    min-width: 32px;
    text-align: center;
}

/* Deprecated: fixed placement replaced by sticky controls bar */
.cache-management-btn.fixed-top-right { }

.action-btn.is-placeholder {
    pointer-events: none;
}
