html, body {
    font-family: Inter, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: #f3f6fb;
    color: #0f172a;
}

body {
    margin: 0;
}

a, .btn-link {
    color: #2563eb;
}

.btn-primary {
    color: #fff;
    background: linear-gradient(135deg, #2563eb, #4f46e5);
    border: none;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #1d4ed8, #4338ca);
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-select:focus, .form-check-input:focus {
    box-shadow: 0 0 0 0.12rem white, 0 0 0 0.25rem rgba(37, 99, 235, 0.25);
}

.rz-button.rz-primary {
    background: linear-gradient(135deg, #2563eb, #4f46e5);
    border: none;
}

.rz-button.rz-primary:hover {
    background: linear-gradient(135deg, #1d4ed8, #4338ca);
}

.rz-button {
    border-radius: 0.85rem;
}

.rz-textbox,
.rz-dropdown,
.rz-numeric,
.rz-textarea {
    width: 100%;
    border-radius: 0.85rem;
}

.rz-data-grid {
    border: none;
}

.modern-grid .rz-datatable-header,
.modern-grid .rz-data-grid-header {
    background: transparent;
    border-bottom: 1px solid rgba(226, 232, 240, 0.9);
}

.modern-grid .rz-column-title {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #64748b;
}

.modern-grid .rz-cell-data,
.modern-grid td {
    color: #0f172a;
}

.rz-paginator {
    border-top: 1px solid rgba(226, 232, 240, 0.9);
}

h1:focus {
    outline: none;
}

.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.page-header h1 {
    margin: 0.2rem 0 0.5rem;
    font-size: clamp(1.9rem, 3vw, 2.6rem);
    font-weight: 800;
}

.page-header p {
    margin: 0;
    color: #475569;
    max-width: 48rem;
}

.eyebrow {
    display: inline-block;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 0.72rem;
    font-weight: 700;
    color: #4f46e5;
}

.stats-grid,
.workspace-grid {
    display: grid;
    gap: 1.25rem;
}

.stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    margin-bottom: 1.5rem;
}

.two-column-grid {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.orders-grid {
    grid-template-columns: minmax(340px, 420px) minmax(0, 1fr);
}

.metric-card,
.surface-card,
.list-card,
.order-card {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 1.2rem;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.06);
}

.metric-card {
    padding: 1.25rem;
    position: relative;
    overflow: hidden;
}

.metric-card::after {
    content: "";
    position: absolute;
    inset: auto -1.2rem -1.2rem auto;
    width: 6rem;
    height: 6rem;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.14);
}

.metric-card span,
.metric-card small {
    display: block;
}

.metric-card span {
    font-weight: 600;
}

.metric-card strong {
    display: block;
    margin: 0.45rem 0;
    font-size: 1.8rem;
    font-weight: 800;
}

.metric-card small {
    color: rgba(255, 255, 255, 0.88);
}

.accent-primary {
    background: linear-gradient(135deg, #2563eb, #3b82f6);
    color: white;
}

.accent-success {
    background: linear-gradient(135deg, #059669, #10b981);
    color: white;
}

.accent-warning {
    background: linear-gradient(135deg, #d97706, #f59e0b);
    color: white;
}

.accent-info {
    background: linear-gradient(135deg, #7c3aed, #8b5cf6);
    color: white;
}

.surface-card {
    padding: 1.35rem;
}

.surface-card.rz-card,
.order-card.rz-card,
.metric-card.rz-card {
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.06);
}

.section-heading {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
}

.section-heading h2 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 750;
}

.section-heading p {
    margin: 0.35rem 0 0;
    color: #64748b;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.full-width {
    grid-column: 1 / -1;
}

label {
    display: block;
    margin-bottom: 0.4rem;
    font-size: 0.92rem;
    font-weight: 600;
    color: #334155;
}

.form-control,
.form-select {
    min-height: 2.8rem;
    border-radius: 0.85rem;
    border-color: rgba(148, 163, 184, 0.35);
}

textarea.form-control {
    min-height: 6.5rem;
}

.modern-table {
    margin-bottom: 0;
}

.modern-table thead th {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #64748b;
    border-bottom-width: 1px;
}

.modern-table tbody td {
    border-color: rgba(226, 232, 240, 0.8);
}

.table-primary {
    font-weight: 700;
}

.table-secondary {
    color: #64748b;
    font-size: 0.9rem;
}

.status-banner {
    border-radius: 1rem;
    padding: 0.9rem 1rem;
    margin-bottom: 1rem;
    font-weight: 600;
}

.status-success {
    background: rgba(16, 185, 129, 0.12);
    color: #047857;
}

.status-error {
    background: rgba(239, 68, 68, 0.12);
    color: #b91c1c;
}

.empty-state {
    color: #64748b;
    padding: 0.4rem 0;
}

.stack-list,
.order-cards,
.line-items-stack {
    display: grid;
    gap: 0.9rem;
}

.order-cards.rz-stack {
    display: grid;
}

.list-card,
.order-card {
    padding: 1rem 1.1rem;
}

.list-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.list-card h3,
.order-card h3 {
    margin: 0;
    font-size: 1.02rem;
}

.list-card p,
.order-card p,
.order-notes {
    margin: 0.35rem 0 0;
    color: #64748b;
}

.list-card-meta {
    text-align: right;
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.4rem 0.7rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    border: none;
}

.badge-success {
    background: rgba(16, 185, 129, 0.14);
    color: #047857;
}

.badge-warning {
    background: rgba(245, 158, 11, 0.16);
    color: #b45309;
}

.badge-danger {
    background: rgba(239, 68, 68, 0.14);
    color: #b91c1c;
}

.badge-muted {
    background: rgba(148, 163, 184, 0.18);
    color: #334155;
}

.line-item-row {
    display: grid;
    grid-template-columns: minmax(0, 1.8fr) 120px 140px auto;
    gap: 0.85rem;
    align-items: end;
}

.line-total-box {
    padding: 0.7rem 0.85rem;
    background: #eef2ff;
    border-radius: 0.85rem;
}

.line-total-value,
.order-total-pill {
    font-weight: 800;
    color: #312e81;
}

.order-actions,
.order-card-footer,
.button-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.order-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 0.85rem;
}

.line-summary-list {
    list-style: none;
    padding: 0;
    margin: 0 0 0.9rem;
    display: grid;
    gap: 0.55rem;
}

.line-summary-list li {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    color: #334155;
}

.order-notes {
    background: #f8fafc;
    border-radius: 0.85rem;
    padding: 0.75rem 0.85rem;
    margin-bottom: 0.85rem;
}

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

.invalid {
    outline: 1px solid #e11d48;
}

.validation-message {
    color: #e11d48;
}

.rz-messages-error,
.validation-message {
    font-size: 0.82rem;
    margin-top: 0.35rem;
}

.blazor-error-boundary {
    background: #991b1b;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

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

@media (max-width: 991.98px) {
    .orders-grid {
        grid-template-columns: 1fr;
    }

    .line-item-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640.98px) {
    .page-header,
    .list-card,
    .order-card-header,
    .order-card-footer {
        flex-direction: column;
        align-items: flex-start;
    }

    .list-card-meta {
        text-align: left;
    }
}
