body {
    --body-font: "Segoe UI Variable", "Segoe UI", sans-serif;
    font-family: var(--body-font);
    font-size: var(--type-ramp-base-font-size);
    line-height: var(--type-ramp-base-line-height);
    margin: 0;
    background: var(--colorNeutralBackground2);
    color: var(--colorNeutralForeground1);
}

.app-layout {
    --layout-header-height: 60px;
    --layout-footer-height: 44px;
}

.app-header {
    display: flex;
    align-items: center;
    padding: 0 1.25rem;
    border-bottom: 1px solid var(--colorNeutralStroke1);
    background: var(--colorNeutralBackground1);
}

.header-gutters {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: 100%;
    min-width: 0;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
}

.theme-toggle {
    width: 36px;
    height: 36px;
    min-width: 36px;
}

.sidebar-toggle {
    width: 36px;
    height: 36px;
    min-width: 36px;
}

.user-header {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    min-width: 0;
}

.user-menu-trigger {
    width: 40px;
    height: 40px;
    min-width: 40px;
    padding: 0;
}

.user-summary {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    min-width: 0;
    line-height: 1.2;
}

.user-name,
.user-email {
    max-width: 14rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-name {
    color: var(--colorNeutralForeground1);
    font-size: var(--type-ramp-base-font-size);
    font-weight: 600;
}

.user-email {
    color: var(--colorNeutralForeground3);
    font-size: var(--type-ramp-minus-1-font-size);
}

.app-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--colorNeutralForeground1);
}

.tenant-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    min-width: 0;
    max-width: min(28rem, 40vw);
    padding: 0.3rem 0.7rem;
    border: 1px solid var(--colorNeutralStroke1);
    border-radius: 999px;
    background: var(--colorNeutralBackground2);
}

.tenant-badge-label {
    color: var(--colorNeutralForeground3);
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
}

.tenant-badge-value {
    min-width: 0;
    overflow: hidden;
    color: var(--colorNeutralForeground1);
    font-size: 0.9rem;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nav-shell {
    background: var(--colorNeutralBackground1);
    border-right: 1px solid var(--colorNeutralStroke1);
    transition: width 160ms ease;
    overflow: hidden;
}

.nav-shell-collapsed {
    width: 64px;
}

.sitenav {
    height: 100%;
}

.sitenav-collapsed {
    overflow: hidden;
}

.content {
    padding: 1.25rem 1.5rem;
    width: 100%;
    box-sizing: border-box;
}

.content-shell {
    min-width: 0;
}

.app-footer {
    background: var(--colorNeutralBackground1);
    color: var(--colorNeutralForeground1);
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--colorNeutralStroke1);
}

.app-footer a {
    text-decoration: none;
}

.app-footer a:focus {
    outline: 1px dashed;
    outline-offset: 3px;
}

.app-footer a:hover {
    text-decoration: underline;
}

.alert {
    border: 1px dashed var(--accent-fill-rest);
    padding: 5px;
    margin: 10px 0;
}

.alert-danger {
    border: 1px dashed var(--error);
}

.alert-success {
    border: 1px dashed var(--success);
}

.alert-warning {
    border: 1px dashed var(--warning);
}

.erp-page {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-width: 0;
}

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

.erp-page-header h1 {
    margin: 0.1rem 0 0;
    font-size: 1.9rem;
    line-height: 1.2;
    font-weight: 650;
    color: var(--colorNeutralForeground1);
}

.erp-eyebrow {
    margin: 0;
    color: var(--colorBrandForeground1);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
}

.erp-page-subtitle {
    max-width: 48rem;
    margin: 0.45rem 0 0;
    color: var(--colorNeutralForeground3);
}

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

.erp-alert {
    border-radius: 6px;
    padding: 0.75rem 0.9rem;
    border: 1px solid var(--colorNeutralStroke1);
    background: var(--colorNeutralBackground1);
}

.erp-alert-success {
    border-color: var(--colorPaletteGreenBorder1);
    color: var(--colorPaletteGreenForeground1);
}

.erp-alert-error {
    border-color: var(--colorPaletteRedBorder1);
    color: var(--colorPaletteRedForeground1);
}

.customer-workspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(320px, 380px);
    gap: 1rem;
    align-items: start;
}

.customer-list-panel,
.customer-side-panel {
    min-width: 0;
    border: 1px solid var(--colorNeutralStroke1);
    border-radius: 8px;
    background: var(--colorNeutralBackground1);
}

.customer-list-panel {
    overflow: hidden;
}

.customer-list-panel-full {
    align-self: flex-start;
    width: 100%;
    max-width: 100%;
}

.customer-toolbar {
    display: grid;
    grid-template-columns: minmax(240px, 1fr) minmax(180px, 240px) auto auto;
    gap: 0.75rem;
    align-items: end;
    padding: 1rem;
    border-bottom: 1px solid var(--colorNeutralStroke1);
}

.customer-toolbar-actions {
    justify-content: flex-end;
    white-space: nowrap;
}

.customer-grid-viewport {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
}

.customer-grid {
    width: 100%;
    min-width: 0;
    max-width: 100%;
}

.row-actions {
    justify-content: flex-end;
    min-height: 32px;
    flex-wrap: nowrap;
    white-space: nowrap;
}

.grid-empty {
    padding: 2rem;
    color: var(--colorNeutralForeground3);
}

.product-stock-cell {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: nowrap;
    white-space: nowrap;
}

.product-stock-value {
    color: var(--colorNeutralForeground1);
    font-weight: 600;
}

.product-stock-meta {
    color: var(--colorNeutralForeground3);
    font-size: 0.82rem;
}

.customer-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 1rem;
    border-top: 1px solid var(--colorNeutralStroke1);
    color: var(--colorNeutralForeground3);
}

.customer-delete-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.customer-dialog {
    --dialog-width: min(720px, calc(100vw - 2rem));
}

.customer-dialog::part(control) {
    border: 1px solid color-mix(in srgb, var(--colorNeutralStroke1) 78%, white);
    border-radius: 18px;
    box-shadow: 0 28px 70px rgba(15, 23, 42, 0.18);
}

.customer-dialog::part(positioning-region) {
    padding: 1rem;
}

.customer-dialog::part(content) {
    padding: 0;
    background:
        radial-gradient(circle at top left, rgba(12, 112, 230, 0.08), transparent 32%),
        linear-gradient(180deg, rgba(248, 250, 252, 0.96), rgba(255, 255, 255, 1) 24%);
}

.customer-dialog fluent-dialog-body {
    padding: 0;
}

.dialog-actions {
    justify-content: flex-end;
    padding-top: 0.35rem;
}

.customer-side-panel {
    padding: 1rem;
    position: sticky;
    top: 1rem;
}

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

.panel-header h2 {
    margin: 0.15rem 0 0;
    font-size: 1.2rem;
    line-height: 1.25;
    color: var(--colorNeutralForeground1);
}

.customer-dialog-header {
    margin: 0;
    padding: 1.5rem 1.5rem 1.15rem;
    border-bottom: 1px solid color-mix(in srgb, var(--colorNeutralStroke2) 82%, white);
}

.customer-dialog-heading {
    display: grid;
    gap: 0.45rem;
}

.customer-dialog-heading .erp-eyebrow {
    letter-spacing: 0.04em;
}

.customer-dialog-heading h2 {
    margin: 0;
    font-size: 1.55rem;
    font-weight: 680;
}

.customer-dialog-subtitle {
    max-width: 52ch;
    margin: 0;
    color: var(--colorNeutralForeground3);
    line-height: 1.5;
}

.customer-form {
    display: block;
}

.customer-form-body {
    display: grid;
    gap: 1.25rem;
    padding: 1.35rem 1.5rem 1.5rem;
}

.customer-validation-summary {
    margin: 0;
    padding: 0.85rem 1rem;
    border: 1px solid var(--colorPaletteRedBorder2);
    border-radius: 12px;
    background: color-mix(in srgb, var(--colorPaletteRedBackground1) 86%, white);
    color: var(--colorPaletteRedForeground1);
}

.customer-validation-summary:empty {
    display: none;
}

.customer-validation-summary ul {
    margin: 0;
    padding-left: 1.1rem;
}

.customer-form-alert {
    padding: 0.85rem 1rem;
    border-radius: 12px;
    border: 1px solid var(--colorPaletteRedBorder2);
    background: color-mix(in srgb, var(--colorPaletteRedBackground1) 86%, white);
    color: var(--colorPaletteRedForeground1);
    line-height: 1.45;
}

.customer-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem 1.15rem;
}

.customer-form-field {
    display: grid;
    gap: 0.42rem;
    align-content: start;
    min-width: 0;
}

.customer-form-field-full {
    grid-column: 1 / -1;
}

.customer-field-hint {
    margin: 0;
    font-size: 0.86rem;
    line-height: 1.45;
    color: var(--colorNeutralForeground3);
}

.customer-field-validation {
    color: var(--colorPaletteRedForeground1);
    font-size: 0.84rem;
    line-height: 1.35;
}

.customer-field-validation:empty {
    display: none;
}

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

.sale-detail-header h2 {
    margin: 0 0 0.25rem;
    font-size: 1.05rem;
    line-height: 1.3;
    font-weight: 650;
}

.sale-detail-header strong,
.sale-detail-subtotal {
    color: var(--colorNeutralForeground1);
    white-space: nowrap;
}

.sale-detail-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.sale-detail-grid {
    border: 1px solid var(--colorNeutralStroke1);
    border-radius: 6px;
    background: var(--colorNeutralBackground1);
}

.product-toggle-field {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    color: var(--colorNeutralForeground1);
    font-weight: 600;
}

.customer-dialog-actions {
    padding-top: 1rem;
    border-top: 1px solid color-mix(in srgb, var(--colorNeutralStroke2) 82%, white);
}

.customer-detail-list {
    display: grid;
    gap: 0.75rem;
    margin: 0 0 1rem;
}

.customer-detail-list div {
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--colorNeutralStroke2);
}

.customer-detail-list dt {
    color: var(--colorNeutralForeground3);
    font-size: 0.78rem;
    font-weight: 650;
}

.customer-detail-list dd {
    margin: 0.2rem 0 0;
    color: var(--colorNeutralForeground1);
    overflow-wrap: anywhere;
}

.delete-confirmation {
    display: grid;
    gap: 0.65rem;
    padding: 0.9rem;
    border: 1px solid var(--colorPaletteRedBorder1);
    border-radius: 8px;
    background: var(--colorPaletteRedBackground1);
}

.delete-confirmation p,
.empty-detail p {
    margin: 0;
    color: var(--colorNeutralForeground3);
}

.empty-detail {
    display: grid;
    gap: 0.35rem;
    color: var(--colorNeutralForeground1);
}

.text-danger {
    color: var(--colorPaletteRedForeground1);
    margin: 0;
}

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

    #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+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC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DAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::before {
        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;
}

@media (max-width: 600px) {
    .header-gutters {
        margin-right: 3rem;
    }

    [dir="rtl"] .header-gutters {
        margin-left: 3rem;
        margin-right: 0;
    }

    .content {
        padding: 1rem;
    }

    .tenant-badge-label {
        display: none;
    }

    .tenant-badge {
        max-width: 10rem;
        padding-inline: 0.6rem;
    }

    .user-summary {
        display: none;
    }
}

@media (max-width: 980px) {
    .erp-page-header {
        flex-direction: column;
    }

    .customer-grid-viewport {
        overflow-x: auto;
    }

    .customer-workspace {
        grid-template-columns: 1fr;
    }

    .customer-side-panel {
        position: static;
    }
}

@media (min-width: 981px) {
    .customer-grid-viewport {
        overflow-x: hidden;
    }
}

@media (max-width: 640px) {
    .customer-toolbar-actions,
    .panel-actions {
        width: 100%;
        align-items: stretch;
        flex-direction: column;
    }

    .customer-toolbar {
        grid-template-columns: 1fr;
    }

    .customer-form-grid {
        grid-template-columns: 1fr;
    }

    .sale-detail-header {
        align-items: stretch;
        flex-direction: column;
    }

    .sale-detail-actions {
        align-items: stretch;
        justify-content: flex-start;
        flex-direction: column;
    }

    .sale-detail-header strong {
        white-space: normal;
    }

    .customer-dialog-header,
    .customer-form-body {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .customer-pagination,
    .customer-delete-banner {
        align-items: stretch;
        flex-direction: column;
    }
}

/* Table */

table {
    width: 100%;
    border-collapse: collapse;
    border-spacing: 0;
}

    table td,
    table th {
        padding: var(--spacingVerticalS) var(--spacingHorizontalM);
        text-align: left;
        vertical-align: middle;
        border-bottom: calc(var(--stroke-width) * 1px) solid var(--neutral-stroke-divider-rest);
    }
