:root {
    --ff-sans: 'DM Sans', system-ui, -apple-system, sans-serif;
    --ff-mono: 'SF Mono', 'Monaco', 'Consolas', monospace;
    --color-primary: #0ea5e9;
    --color-primary-dark: #0284c7;
    --color-surface: #f8fafc;
    --color-surface-elevated: #ffffff;
    --color-border: #e2e8f0;
    --color-text: #1e293b;
    --color-text-muted: #64748b;
    --color-text-subtle: #94a3b8;
    --radius-sm: 8px;
    --radius-md: 10px;
    --radius-lg: 12px;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
}

html, body {
    font-family: var(--ff-sans);
}

h1:focus {
    outline: none;
}

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

.btn-primary {
    color: #fff;
    background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
    border: none;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
}

.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;
}

/* List pages - cards & tables */
.list-page-header {
    margin-bottom: 1.5rem;
}

.list-page-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 0.25rem;
}

.list-page-header p {
    font-size: 0.95rem;
    color: #64748b;
    margin: 0;
}

.list-page-table {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow-x: auto; /* allow wide tables to scroll instead of clipping rows */
    overflow-y: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.list-page-table .table tbody td,
.list-page-table .table thead th {
    white-space: nowrap; /* keep rows compact; horizontal scroll handles overflow */
}

/* Action columns commonly hold 3-7 buttons. Force them onto one line. */
.list-page-table .table .text-end,
.list-page-table .table td:last-child {
    white-space: nowrap;
}

.list-page-table .table .btn-sm {
    margin-bottom: 0;
}

.list-page-table .table {
    margin: 0;
}

.list-page-table .table thead th {
    background: #f8fafc;
    font-size: 0.75rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0.875rem 1rem;
    border-bottom: 1px solid #e2e8f0;
}

.list-page-table .table tbody td {
    padding: 0.875rem 1rem;
    vertical-align: middle;
}

.list-page-table .table tbody tr {
    transition: background 0.15s ease;
}

.list-page-table .table tbody tr:hover {
    background: #f8fafc;
}

.list-page-table .table tbody td a:not(.btn) {
    color: #1e293b;
    font-weight: 500;
    text-decoration: none;
}

.list-page-table .table tbody td a:not(.btn):hover {
    color: #0ea5e9;
}

.list-page-empty {
    padding: 2rem;
    text-align: center;
    color: #94a3b8;
}

.list-page-empty a {
    color: #0ea5e9;
    text-decoration: none;
}

.list-page-empty a:hover {
    text-decoration: underline;
}

.list-loading {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 2rem;
    color: #64748b;
}

.canvas-form-renderer {
    background: #fafbfc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}

.canvas-form-renderer .canvas-field {
    box-sizing: border-box;
}

.list-loading::before {
    content: "";
    width: 24px;
    height: 24px;
    border: 2px solid #e2e8f0;
    border-top-color: #0ea5e9;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

.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,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5z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Dg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) 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: relative;
    display: block;
    width: 8rem;
    height: 8rem;
    margin: 20vh auto 1rem 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;
}

/* Form.io-style Layout Components */
.form-content {
    padding: 0.75rem;
    color: #1e293b;
    line-height: 1.6;
}

.form-content p {
    margin-bottom: 0.5rem;
}

.form-content p:last-child {
    margin-bottom: 0;
}

.form-fieldset {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1rem;
    margin: 1rem 0;
    background: #f8fafc;
}

.form-fieldset legend {
    padding: 0 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: #475569;
}

.well {
    min-height: 20px;
    padding: 1rem;
    margin-bottom: 1rem;
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05);
}

.canvas-columns-preview {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
    padding: 0.25rem;
}

.canvas-column {
    flex: 1;
    padding: 0.25rem 0.5rem;
    background: #f1f5f9;
    border: 1px dashed #cbd5e1;
    border-radius: 4px;
    font-size: 0.7rem;
    color: #64748b;
    text-align: center;
}

.form-tree {
    padding: 0.5rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}

.form-tree-list {
    list-style: none;
    margin: 0;
    padding-left: 1rem;
}

.form-tree-list > li {
    margin: 0.2rem 0;
}

.form-tree-list details summary {
    cursor: pointer;
    font-weight: 600;
    color: #334155;
}