/* Scenario admin root: vertical layout */
.scenario-admin-root {
    display: flex;
    flex-direction: column;
    gap: 16px;
    flex: 1 1 auto;
    min-height: 0;
}

/* Top section: scenario list */
.scenario-list-section {
    /* Uses admin-section styling already */
}

/* Scrollable list of scenarios (~5 rows) */
.scenario-list-scroll {
    max-height: 220px;     /* tweak to taste; around 5 rows */
    overflow-y: auto;
}

/* Bottom section: detail editor */
.scenario-detail-section {
    /* Uses admin-section styling already */
}

/* Inputs sizing */
.scenario-name-input,
.scenario-desc-input{
    width: 100%;
    box-sizing: border-box;
}

.scenario-json-input {
    width: 100%;
    flex: 1 1 auto;
    box-sizing: border-box;
}

.scenario-form-row {
    margin-bottom: 8px;
}

.scenario-form-row label {
    display: block;
    margin-bottom: 4px;
    font-size: 0.85rem;
    color: #9ca3af;
}

.scenario-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.scenario-detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.scenario-detail-header h3 {
    margin: 0;
}

.scenario-detail-actions {
    display: flex;
    gap: 8px;
}

.services-layout {
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-items: stretch;
}

.services-list {
    flex: 0 0 auto;
    min-width: 0;
}

.services-detail {
    flex: 1 1 auto;
    min-width: 0;
}

.svc-attrs-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.svc-attrs-table th,
.svc-attrs-table td {
    vertical-align: top;
}

.svc-attrs-json-container {
    margin-top: 8px;
}

.scheduled-layout {
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-items: stretch;
}

.scheduled-list {
    flex: 0 0 auto;
    min-width: 0;
}

.scheduled-detail {
    flex: 1 1 auto;
    min-width: 0;
}

.scenario-detail-section {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
}

/* Editor uses full height inside the bottom detail section */
.scenario-editor {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;   /* instead of height: 100% */
    min-height: 0;
}

/* Tab content stretches under the tab header and scrolls */
.scenario-tabs-content {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
}

/* Each tab panel fills the available height inside .scenario-tabs-content */
.scenario-tab-panel {
    height: 100%;
    display: flex;
    flex-direction: column;
    min-height: 0; /* needed so children can scroll */
}

/* Raw JSON tab: let the row with the textarea take all remaining space */
.raw-json-row {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.raw-json-row .scenario-json-input {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    box-sizing: border-box;
    resize: none; /* or 'vertical' if you prefer manual resize */
}

.usecase-step-editor {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.step-tabs-header {
    margin-bottom: 8px;
}

.step-tabs-content {
    flex: 1 1 auto;
    min-height: 0;
}

/* --- Generic tab strip styling --- */
.scenario-tabs-header,
.usecase-tabs-header,
.step-tabs-header {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid #ddd;
    margin-bottom: 8px;
}

/* Base tab button style (inactive by default) */
.scenario-tab-button {
    border: 1px solid #d1d5db;
    border-radius: 4px 4px 0 0;
    padding: 6px 12px;
    background: #f3f4f6;        /* light gray */
    color: #4b5563;              /* gray-700 */
    font-size: 0.9rem;
    cursor: pointer;
    outline: none;
    margin-bottom: -1px;         /* so active tab looks "connected" to content */
}

/* Hover for any tab */
.scenario-tab-button:hover {
    background: #e5e7eb;
}

/* Active tab: highlighted and visually "on top" */
.scenario-tab-button.scenario-tab-active {
    background: #ffffff;
    color: #111827;              /* nearly black */
    border-color: #2563eb;       /* blue border for active tab */
    font-weight: 600;
    box-shadow: 0 -1px 0 #ffffff; /* merges with content panel border */
}

.save-status-dot {
    display: inline-block;
    margin-left: 0.4rem;
    font-size: 0.8rem;
    vertical-align: middle;
}

.save-status-dot.save-status-clean {
    color: #2ecc71; /* green */
}

.save-status-dot.save-status-dirty {
    color: #e74c3c; /* red */
}

.spans-layout {
    display: flex;
    flex-direction: row;
    gap: 16px;
    align-items: flex-start;
}

.spans-list {
    flex: 0 0 40%;
    min-width: 260px;
}

.spans-detail {
    flex: 1 1 auto;
}

.duration-editor {
    border: 1px solid #444;
    border-radius: 6px;
    padding: 8px 12px;
    margin-top: 8px;
}
.duration-fields label {
    font-size: 0.9rem;
}

.usecase-flow-host { margin-bottom: 12px; }
.usecase-flow-diagram-header { font-weight: 600; margin: 6px 0; }
.usecase-steps-layout.usecase-steps-layout--no-list {
    display: block; /* overrides any flex layout expectations */
}

.usecase-steps-layout.usecase-steps-layout--no-list .usecase-step-detail {
    width: 100%;
}

.user-admin-table tr.row-selected td {
    background: #eef2ff;
}

.scenario-list-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}