html, body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

h1:focus {
    outline: none;
}

a, .btn-link {
    color: #0071c1;
}

.btn-primary {
    color: #fff;
    background-color: #1b6ec2;
    border-color: #1861ac;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

.content {
    padding-top: 1.1rem;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid red;
}

.validation-message {
    color: red;
}

#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.5rem;
    }

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5I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I2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.loading-progress {
    position: absolute;
    display: block;
    width: 8rem;
    height: 8rem;
    inset: 20vh 0 auto 0;
    margin: 0 auto 0 auto;
}

    .loading-progress circle {
        fill: none;
        stroke: #e0e0e0;
        stroke-width: 0.6rem;
        transform-origin: 50% 50%;
        transform: rotate(-90deg);
    }

        .loading-progress circle:last-child {
            stroke: #1b6ec2;
            stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
            transition: stroke-dasharray 0.05s ease-in-out;
        }

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: bold;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

    .loading-progress-text:after {
        content: var(--blazor-load-percentage-text, "Loading");
    }

code {
    color: #c02d76;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}

.auth-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    min-width: 0;
    max-width: 100%;
}

.kpi-tile {
    display: flex !important;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 5.5rem;
    border-radius: 0.75rem !important;
    transition: box-shadow 0.15s ease, border-color 0.15s ease, transform 0.1s ease, background-color 0.15s ease;
}

.kpi-tile-value {
    font-weight: 700 !important;
    line-height: 1.1 !important;
    margin: 0 !important;
}

.kpi-tile-label {
    display: block;
    margin-top: 0.35rem !important;
    color: var(--mud-palette-text-secondary);
    font-weight: 500 !important;
    letter-spacing: 0.01em;
}

.kpi-tile--interactive {
    cursor: pointer;
    user-select: none;
}

.kpi-tile--interactive:hover {
    transform: translateY(-2px);
    border-color: var(--mud-palette-primary) !important;
    box-shadow: 0 6px 16px rgba(16, 24, 40, 0.1) !important;
}

.kpi-tile--active {
    background: color-mix(in srgb, var(--mud-palette-primary) 8%, white) !important;
    border-color: var(--mud-palette-primary) !important;
}

.kpi-tile--static {
    background: var(--mud-palette-background-grey, #f8fafc) !important;
}

/* Legacy aliases kept for any remaining detail pages */
.kpi-card {
    background: #fff;
    border: 1px solid #c5ced9;
    border-radius: 0.65rem;
    padding: 0.85rem 0.75rem 0.7rem;
    text-align: center;
}

.kpi-value {
    display: block;
    font-size: 1.75rem;
    font-weight: 700;
    color: #1b6ec2;
}

.kpi-label {
    display: block;
    font-size: 0.85rem;
    color: #6c757d;
}

.chart-grid, .console-grid, .inbox-grid {
    display: grid;
    gap: 1rem;
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

.chart-grid {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
}

.chart-grid--instances {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.chart-grid--instances .chart-card--wide {
    grid-column: 1 / -1;
}

.instance-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-width: 0;
    max-width: 100%;
}

.instance-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 0.75rem 0.85rem;
    align-items: start;
    padding: 0.9rem 1rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.65rem;
    background: #fbfcfd;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.instance-row:hover {
    border-color: #cfd8e3;
    background: #fff;
}

.instance-row--selected {
    border-color: #9eb6d4;
    background: #f4f8fc;
}

.instance-row-select {
    padding-top: 0.35rem;
}

.instance-row-main {
    min-width: 0;
    overflow-wrap: anywhere;
}

.instance-row-title {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    align-items: center;
    margin-bottom: 0.45rem;
}

.instance-row-title a {
    font-weight: 650;
    color: #1a1f36;
    text-decoration: none;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.92rem;
}

.instance-row-title a:hover {
    color: #1b6ec2;
}

.instance-row-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 1rem;
    color: #6c757d;
    font-size: 0.86rem;
}

.instance-row-meta a {
    color: #1b6ec2;
    text-decoration: none;
}

.instance-row-meta a:hover {
    text-decoration: underline;
}

.instance-row-meta strong {
    color: #344054;
    font-weight: 600;
}

.instance-row-actions {
    grid-column: 2;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    justify-content: flex-start;
    max-width: 100%;
    min-width: 0;
}

.console-grid {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.inbox-grid {
    grid-template-columns: minmax(240px, 320px) 1fr;
}

.chart-card, .filter-bar .card-body {
    background: #fff;
}

.chart-card {
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    padding: 1rem;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    box-sizing: border-box;
}

.chart-canvas-wrap {
    position: relative;
    width: 100%;
    height: 200px;
    max-height: 200px;
    max-width: 100%;
    overflow: hidden;
}

.chart-canvas-wrap--tall {
    height: 220px;
    max-height: 220px;
}

.chart-card canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
}

.detail-panel {
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}

.filter-bar {
    min-width: 0;
    max-width: 100%;
}

/* Chart wraps contain sideways growth; main pane must still scroll vertically. */
html, body, #app {
    height: 100%;
}

.mud-layout {
    height: 100%;
    overflow: hidden;
}

.mud-main-content {
    overflow-x: hidden !important;
    overflow-y: auto !important;
    height: 100%;
    box-sizing: border-box;
    min-width: 0;
}

.mud-main-content > .content,
.mud-main-content .mud-container {
    max-width: 100%;
    min-width: 0;
    padding-bottom: 2rem;
}

.chart-toolbar {
    margin-bottom: 1rem;
}

.toolbar, .actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.status-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: capitalize;
    background: #e9ecef;
}

.status-running { background: #cfe2ff; color: #084298; }
.status-suspended, .status-paused { background: #fff3cd; color: #664d03; }
.status-completed { background: #d1e7dd; color: #0f5132; }
.status-faulted, .status-cancelled { background: #f8d7da; color: #842029; }

.log-panel {
    max-height: 360px;
    overflow-y: auto;
    font-family: ui-monospace, monospace;
    font-size: 0.85rem;
}

.log-line {
    padding: 0.25rem 0;
    border-bottom: 1px solid #f1f3f5;
}

.elsa-studio-container {
    min-height: 720px;
    height: calc(100vh - 220px);
    border: 1px solid #ced4da;
    border-radius: 0.5rem;
    background: #fff;
    overflow: hidden;
}

.elsa-studio-frame {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 720px;
    border: 0;
}

/* —— Catalog / detail enrichment —— */
.page-hero {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
    margin-bottom: 1.25rem;
    min-width: 0;
    max-width: 100%;
}

.page-hero-copy h1 {
    margin: 0 0 0.35rem;
    font-size: 1.75rem;
    font-weight: 650;
}

.page-hero-subtitle {
    margin: 0;
    color: #5c6770;
    max-width: 48rem;
}

.page-hero-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.75rem;
}

.page-hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.catalog-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.catalog-search {
    min-width: min(100%, 280px);
    flex: 1;
}

.catalog-list {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.catalog-card {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 1rem;
    padding: 1rem 1.15rem;
    background: #fff;
    border: 1px solid #d9dee5;
    border-radius: 0.65rem;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.catalog-card:hover {
    border-color: #9eb6d4;
    box-shadow: 0 4px 12px rgba(16, 24, 40, 0.06);
}

.catalog-card-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 650;
}

.catalog-card-title a {
    color: inherit;
    text-decoration: none;
}

.catalog-card-title a:hover {
    color: #1b6ec2;
}

.catalog-card-desc {
    margin: 0.35rem 0 0;
    color: #5c6770;
    font-size: 0.92rem;
}

.catalog-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.55rem;
}

.tag-chip {
    display: inline-block;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    background: #eef2f7;
    color: #334155;
    font-size: 0.75rem;
    font-weight: 600;
}

.publish-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
}

.publish-chip--published { background: #d1e7dd; color: #0f5132; }
.publish-chip--draft { background: #fff3cd; color: #664d03; }
.publish-chip--unpublished { background: #e9ecef; color: #495057; }

.catalog-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1.25rem;
    margin-top: 0.75rem;
    font-size: 0.82rem;
    color: #475569;
}

.catalog-stat strong {
    color: #0f172a;
    font-variant-numeric: tabular-nums;
}

.catalog-stat--danger strong { color: #842029; }
.catalog-stat--info strong { color: #084298; }

.variable-shape {
    max-height: 12rem;
    overflow: auto;
    padding: 0.5rem 0.65rem;
    border-radius: 0.35rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    font-size: 0.78rem;
    color: #0f172a;
    white-space: pre;
}

.catalog-owner {
    margin-top: 0.55rem;
    font-size: 0.8rem;
    color: #64748b;
}

.catalog-card-actions {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    align-items: stretch;
    min-width: 7.5rem;
}

.detail-panel {
    background: #fff;
    border: 1px solid #d9dee5;
    border-radius: 0.65rem;
    padding: 1rem 1.15rem;
    margin-bottom: 1rem;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}

.detail-panel h2 {
    margin: 0 0 0.85rem;
    font-size: 1.05rem;
    font-weight: 650;
}

.detail-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.detail-kpi {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    padding: 0.75rem;
    text-align: center;
}

.detail-kpi-value {
    display: block;
    font-size: 1.4rem;
    font-weight: 700;
    color: #1b6ec2;
}

.detail-kpi-label {
    display: block;
    font-size: 0.75rem;
    color: #64748b;
    margin-top: 0.15rem;
}

.detail-split {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
}

.inbox-task-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.75rem;
    margin-top: 0.35rem;
    font-size: 0.78rem;
}

.inbox-task-meta .escalated {
    color: #842029;
    font-weight: 700;
}

@media (max-width: 720px) {
    .catalog-card {
        grid-template-columns: 1fr;
    }

    .catalog-card-actions {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .chart-grid--instances {
        grid-template-columns: 1fr;
    }

    .instance-row {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .instance-row-actions {
        grid-column: 2;
        justify-content: flex-start;
    }
}