.workflow-templates-page {
    --template-border: var(--bs-border-color, #e2e8f0);
    --template-muted: var(--bs-secondary-color, #64748b);
    --template-surface: var(--bs-body-bg, #fff);
    width: 100%;
}

.workflow-templates-page .page-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1.5rem;
    margin-bottom: 1.75rem;
}

.workflow-templates-page .breadcrumb {
    font-size: .8125rem;
}

.workflow-templates-page .breadcrumb a {
    color: var(--template-muted);
    text-decoration: none;
}

.workflow-templates-page .breadcrumb a:hover {
    color: var(--bs-primary, #0d6efd);
}

.workflow-templates-page .page-icon {
    display: grid;
    width: 2.75rem;
    height: 2.75rem;
    place-items: center;
    color: var(--bs-primary, #0d6efd);
    background: rgba(var(--bs-primary-rgb, 13, 110, 253), .1);
    border-radius: .75rem;
    font-size: 1.25rem;
}

.workflow-templates-page .page-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .625rem;
}

.workflow-templates-page .template-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.workflow-templates-page .template-stat {
    display: flex;
    align-items: center;
    gap: .875rem;
    min-height: 5.5rem;
    padding: 1rem 1.125rem;
    background: var(--template-surface);
    border: 1px solid var(--template-border);
    border-radius: .75rem;
}

.workflow-templates-page .template-stat-icon {
    display: grid;
    width: 2.5rem;
    height: 2.5rem;
    place-items: center;
    background: currentColor;
    background: color-mix(in srgb, currentColor 12%, transparent);
    border-radius: .625rem;
    font-size: 1rem;
}

.workflow-templates-page .template-stat-value,
.workflow-templates-page .template-stat-label {
    display: block;
}

.workflow-templates-page .template-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.1;
}

.workflow-templates-page .template-stat-label {
    margin-top: .25rem;
    color: var(--template-muted);
    font-size: .75rem;
    font-weight: 600;
    letter-spacing: .02em;
}

.workflow-templates-page .template-toolbar {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin-bottom: .75rem;
    padding: .75rem;
    background: var(--template-surface);
    border: 1px solid var(--template-border);
    border-radius: .75rem;
}

.workflow-templates-page .template-search {
    position: relative;
    flex: 1 1 16rem;
}

.workflow-templates-page .template-search i {
    position: absolute;
    top: 50%;
    left: .875rem;
    color: var(--template-muted);
    transform: translateY(-50%);
    pointer-events: none;
}

.workflow-templates-page .template-search .form-control {
    padding-left: 2.375rem;
}

.workflow-templates-page .template-filters {
    display: flex;
    align-items: center;
    gap: .5rem;
}

.workflow-templates-page .template-filters .form-select {
    min-width: 8.5rem;
    font-size: .875rem;
}

.workflow-templates-page .template-clear-filters {
    padding: .375rem .5rem;
    white-space: nowrap;
    font-size: .8125rem;
    text-decoration: none;
}

.workflow-templates-page .template-view-toggle {
    flex: 0 0 auto;
}

.workflow-templates-page .template-view-toggle .btn {
    width: 2.5rem;
}

.workflow-templates-page .template-results-bar {
    min-height: 1.5rem;
    margin: 0 .25rem .5rem;
    font-size: .8125rem;
}

.workflow-templates-page .template-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--template-surface);
    border: 1px solid var(--template-border);
    border-radius: .75rem;
    box-shadow: 0 .125rem .25rem rgba(15, 23, 42, .04);
    transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}

.workflow-templates-page .template-card:hover {
    border-color: rgba(var(--bs-primary-rgb, 13, 110, 253), .35);
    box-shadow: 0 .5rem 1.25rem rgba(15, 23, 42, .09);
    transform: translateY(-2px);
}

.workflow-templates-page .template-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: .75rem;
    padding: 1rem 1.125rem;
    border-bottom: 1px solid var(--template-border);
}

.workflow-templates-page .template-icon,
.workflow-templates-page .template-list-icon {
    display: grid;
    flex: 0 0 auto;
    width: 2.5rem;
    height: 2.5rem;
    place-items: center;
    background: var(--bs-tertiary-bg, #f1f5f9);
    border-radius: .625rem;
    font-size: 1.35rem;
}

.workflow-templates-page .template-card-title {
    overflow: hidden;
    margin: .1rem 0 .2rem;
    font-size: 1rem;
    font-weight: 650;
    line-height: 1.3;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.workflow-templates-page .template-id {
    display: block;
    overflow: hidden;
    color: var(--template-muted);
    font-size: 0.75rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.workflow-templates-page .template-card-body {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    padding: 1rem 1.125rem;
}

.workflow-templates-page .template-description {
    min-height: 3.75rem;
    margin-bottom: 1rem;
    color: var(--template-muted);
    font-size: .875rem;
    line-height: 1.5;
}

.workflow-templates-page .template-meta-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: .5rem;
    padding: .75rem 0;
    border-top: 1px solid var(--template-border);
    border-bottom: 1px solid var(--template-border);
}

.workflow-templates-page .template-meta-grid div {
    min-width: 0;
}

.workflow-templates-page .template-meta-grid span,
.workflow-templates-page .template-meta-grid strong {
    display: block;
}

.workflow-templates-page .template-meta-grid span {
    color: var(--template-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.workflow-templates-page .template-meta-grid strong {
    margin-top: .2rem;
    font-size: .875rem;
}

.workflow-templates-page .template-tags {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
    min-height: 1.5rem;
    margin-top: .875rem;
}

.workflow-templates-page .template-tags .badge,
.workflow-templates-page .template-table-tags .badge {
    color: var(--template-muted) !important;
    font-size: 0.75rem;
    font-weight: 500;
}

.workflow-templates-page .template-more-tags {
    align-self: center;
    color: var(--template-muted);
    font-size: .75rem;
}

.workflow-templates-page .template-cli {
    margin-top: 1rem;
    padding-top: .75rem;
    border-top: 1px solid var(--template-border);
}

.workflow-templates-page .template-cli-command {
    display: flex;
    align-items: center;
    gap: .5rem;
    min-width: 0;
}

.workflow-templates-page .template-cli-command > span {
    color: var(--template-muted);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.workflow-templates-page .template-cli-command code {
    flex: 1 1 auto;
    overflow: hidden;
    color: var(--bs-body-color);
    font-size: 0.75rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.workflow-templates-page .copy-cli-command {
    flex: 0 0 auto;
    padding: .125rem .25rem;
    color: var(--template-muted);
}

.workflow-templates-page .template-cli-tasks,
.workflow-templates-page .template-table-tasks {
    display: flex;
    flex-wrap: wrap;
    gap: .25rem;
}

.workflow-templates-page .template-cli-tasks {
    margin-top: .5rem;
}

.workflow-templates-page .template-cli-tasks span,
.workflow-templates-page .template-table-tasks span {
    padding: .125rem .375rem;
    color: var(--template-muted);
    background: var(--bs-tertiary-bg, #f1f5f9);
    border-radius: .25rem;
    font-family: var(--bs-font-monospace, monospace);
    font-size: 0.75rem;
}

.workflow-templates-page .template-card-footer {
    align-items: center;
    justify-content: space-between;
}

.workflow-templates-page .template-task-actions,
.workflow-templates-page .template-manage-actions {
    display: flex;
    align-items: center;
    gap: .25rem;
}

.workflow-templates-page .template-task-actions {
    flex: 1 1 auto;
}

.workflow-templates-page .template-task-actions .btn {
    white-space: nowrap;
}

.workflow-templates-page .template-manage-actions {
    border-left: 1px solid var(--template-border);
    padding-left: .375rem;
}

.workflow-templates-page .template-card-footer {
    display: flex;
    gap: .375rem;
    padding: .75rem 1.125rem;
    border-top: 1px solid var(--template-border);
}

.workflow-templates-page .template-card-footer .btn:first-child {
    flex: 1 1 auto;
}

.workflow-templates-page .template-table-wrap {
    overflow: hidden;
    background: var(--template-surface);
    border: 1px solid var(--template-border);
    border-radius: .75rem;
}

.workflow-templates-page .template-table-wrap th {
    color: var(--template-muted);
    background: var(--bs-tertiary-bg, #f8fafc);
    font-size: 0.75rem;
    font-weight: 650;
    letter-spacing: .04em;
    text-transform: uppercase;
    white-space: nowrap;
}

.workflow-templates-page .template-table-wrap td,
.workflow-templates-page .template-table-wrap th {
    padding: .875rem 1rem;
}

.workflow-templates-page .template-table-wrap tbody tr:last-child td {
    border-bottom: 0;
}

.workflow-templates-page .template-list-icon {
    width: 2rem;
    height: 2rem;
    font-size: 1rem;
}

.workflow-templates-page .template-table-tags {
    display: flex;
    flex-wrap: wrap;
    gap: .25rem;
    min-width: 8rem;
}

.workflow-templates-page .template-table-tasks {
    min-width: 12rem;
}

.workflow-templates-page .template-empty-state {
    padding: 4rem 1rem;
    color: var(--template-muted);
    text-align: center;
}

.workflow-templates-page .template-empty-icon {
    display: grid;
    width: 3.5rem;
    height: 3.5rem;
    margin: 0 auto 1rem;
    place-items: center;
    color: var(--template-muted);
    background: var(--bs-tertiary-bg, #f1f5f9);
    border-radius: 1rem;
    font-size: 1.5rem;
}

.workflow-templates-page .is-hidden {
    display: none !important;
}

.workflow-templates-page .cli-terminal-section {
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--template-border);
}

.workflow-templates-page .cli-terminal-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.workflow-templates-page .section-eyebrow {
    display: block;
    margin-bottom: .35rem;
    color: var(--bs-primary, #0d6efd);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.workflow-templates-page .cli-terminal-window {
    overflow: hidden;
    color: #d1fae5;
    background: #111827;
    border: 1px solid #374151;
    border-radius: .75rem;
    box-shadow: 0 .5rem 1.5rem rgba(15, 23, 42, .15);
}

.workflow-templates-page .cli-terminal-bar {
    display: flex;
    align-items: center;
    gap: .4rem;
    padding: .625rem .875rem;
    color: #9ca3af;
    background: #1f2937;
    border-bottom: 1px solid #374151;
    font-size: .75rem;
}

.workflow-templates-page .cli-terminal-bar > span:not(.cli-terminal-status) {
    width: .6rem;
    height: .6rem;
    background: #ef4444;
    border-radius: 50%;
}

.workflow-templates-page .cli-terminal-bar > span:nth-child(2) { background: #f59e0b; }
.workflow-templates-page .cli-terminal-bar > span:nth-child(3) { background: #10b981; }

.workflow-templates-page .cli-terminal-bar code {
    margin-left: .5rem;
    color: #d1d5db;
    font-size: .75rem;
}

.workflow-templates-page .cli-terminal-status {
    margin-left: auto;
    color: #6ee7b7;
    font-size: 0.75rem;
}

.workflow-templates-page .cli-terminal-status i {
    font-size: 0.75rem;
    vertical-align: .1rem;
}

.workflow-templates-page .cli-terminal-output {
    min-height: 10rem;
    max-height: 22rem;
    padding: 1rem 1.125rem;
    overflow-y: auto;
    font-family: var(--bs-font-monospace, monospace);
    font-size: .75rem;
    line-height: 1.65;
    white-space: pre-wrap;
}

.workflow-templates-page .cli-terminal-line {
    margin-bottom: .35rem;
    word-break: break-word;
}

.workflow-templates-page .cli-terminal-line code {
    color: #a7f3d0;
}

.workflow-templates-page .cli-terminal-command { color: #f9fafb; }
.workflow-templates-page .cli-terminal-success { color: #a7f3d0; }
.workflow-templates-page .cli-terminal-error { color: #fca5a5; }
.workflow-templates-page .cli-terminal-muted { color: #9ca3af; }

.workflow-templates-page .cli-terminal-form {
    display: flex;
    align-items: center;
    gap: .625rem;
    padding: .75rem 1.125rem;
    background: #0b1220;
    border-top: 1px solid #374151;
}

.workflow-templates-page .cli-terminal-prompt {
    color: #6ee7b7;
    font-family: var(--bs-font-monospace, monospace);
    font-weight: 700;
}

.workflow-templates-page .cli-terminal-form input {
    flex: 1 1 auto;
    min-width: 0;
    padding: .35rem 0;
    color: #f9fafb;
    background: transparent;
    border: 0;
    outline: 0;
    font-family: var(--bs-font-monospace, monospace);
    font-size: .75rem;
}

.workflow-templates-page .cli-terminal-form input::selection {
    color: #111827;
    background: #a7f3d0;
}

.workflow-templates-page .cli-quick-commands {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .5rem;
    margin-top: .75rem;
    color: var(--template-muted);
    font-size: .75rem;
}

.workflow-templates-page .cli-command-chip {
    padding: .25rem .5rem;
    color: var(--template-muted);
    background: var(--template-surface);
    border: 1px solid var(--template-border);
    border-radius: .375rem;
    font-family: var(--bs-font-monospace, monospace);
    font-size: 0.75rem;
}

.workflow-templates-page .cli-command-chip:hover,
.workflow-templates-page .cli-command-chip:focus-visible {
    color: var(--bs-primary, #0d6efd);
    border-color: var(--bs-primary, #0d6efd);
}

.template-yaml-input {
    min-height: 18rem;
    resize: vertical;
    tab-size: 2;
}

@media (max-width: 1100px) {
    .workflow-templates-page .template-toolbar {
        flex-wrap: wrap;
    }

    .workflow-templates-page .template-search {
        flex-basis: 100%;
    }

    .workflow-templates-page .template-filters {
        flex: 1 1 auto;
    }
}

@media (max-width: 768px) {
    .workflow-templates-page .page-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .workflow-templates-page .page-actions,
    .workflow-templates-page .page-actions .btn {
        width: 100%;
    }

    .workflow-templates-page .page-actions .btn {
        flex: 1 1 auto;
    }

    .workflow-templates-page .template-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .workflow-templates-page .template-filters {
        flex-wrap: wrap;
        width: calc(100% - 3.25rem);
    }

    .workflow-templates-page .cli-terminal-heading {
        align-items: stretch;
        flex-direction: column;
    }

    .workflow-templates-page .template-filters > div {
        flex: 1 1 8rem;
    }

    .workflow-templates-page .template-filters .form-select {
        width: 100%;
        min-width: 0;
    }

    .workflow-templates-page .template-clear-filters {
        padding-left: 0;
    }
}

@media (max-width: 480px) {
    .workflow-templates-page .template-stats {
        grid-template-columns: 1fr;
    }

    .workflow-templates-page .template-stat {
        min-height: 4.75rem;
    }

    .workflow-templates-page .template-toolbar {
        align-items: flex-start;
    }

    .workflow-templates-page .template-view-toggle {
        margin-top: .25rem;
    }
}
