:root {
    --font-ui: "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --brand-primary: #362F2D;
    --brand-primary-2: #4a403d;
    --brand-line: #d7cfcb;
    --radius-md: 10px;
    --radius-lg: 14px;
    --ux-on-light: #0f172a;
    --ux-on-light-muted: #475569;
    --ux-light-surface: #f8fafc;
    --ux-light-border: #dbe3ec;
}

html,
body {
    font-family: var(--font-ui);
    font-size: 14px;
    line-height: 1.5;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body {
    overflow-x: hidden;
}

.boot-loading-shell {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(248, 250, 252, .68);
    backdrop-filter: blur(12px) saturate(.9);
}

.boot-loading-card {
    width: auto;
    max-width: min(320px, 78vw);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.boot-loading-mark {
    width: 54px;
    height: 54px;
    border-radius: 999px;
    border: 3px solid rgba(15, 23, 42, .14);
    border-top-color: rgba(15, 23, 42, .78);
    animation: brand-loading-spin .78s linear infinite;
}

.boot-loading-logo-shell {
    position: relative;
    width: clamp(132px, 30vw, 220px);
    height: clamp(52px, 10vw, 78px);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.boot-loading-logo {
    display: none;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.boot-loading-logo-base {
    filter: grayscale(1);
    opacity: .18;
}

.boot-loading-logo-reveal {
    display: none;
    position: absolute;
    inset: 0;
    overflow: hidden;
    width: 100%;
    clip-path: inset(0 100% 0 0);
    animation: brand-logo-reveal 1.9s ease-in-out infinite;
}

.boot-loading-logo-reveal .boot-loading-logo {
    display: block;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-ui);
    letter-spacing: -0.01em;
    line-height: 1.25;
    margin-top: 0;
}

h1:focus {
    outline: none;
}

.content-area {
    font-size: 0.95rem;
}

.content-area a,
.content-area .btn-link {
    color: var(--brand-primary);
}

.content-area .btn-primary {
    color: #fff;
    background: linear-gradient(180deg, var(--brand-primary) 0%, var(--brand-primary-2) 100%);
    border-color: #2f2826;
}

/* Global readable baseline for light surfaces in content area. */
.content-area .ux-surface-light,
.content-area .card.bg-light,
.content-area .bg-light,
.content-area .alert-light,
.content-area .table-light {
    color: var(--ux-on-light) !important;
}

.content-area .ux-surface-light .text-muted,
.content-area .card.bg-light .text-muted,
.content-area .bg-light .text-muted,
.content-area .alert-light .text-muted,
.content-area .table-light .text-muted {
    color: var(--ux-on-light-muted) !important;
}

.content-area .ux-surface-light .badge:not(.text-bg-dark):not(.bg-dark),
.content-area .card.bg-light .badge:not(.text-bg-dark):not(.bg-dark),
.content-area .bg-light .badge:not(.text-bg-dark):not(.bg-dark),
.content-area .alert-light .badge:not(.text-bg-dark):not(.bg-dark) {
    color: var(--ux-on-light) !important;
}

.content-area .ux-surface-light,
.content-area .ux-surface-light *,
.content-area .card.bg-light,
.content-area .card.bg-light *,
.content-area .bg-light,
.content-area .bg-light * {
    border-color: inherit;
}

.content-area .btn:focus,
.content-area .btn:active:focus,
.content-area .btn-link.nav-link:focus,
.content-area .form-control:focus,
.content-area .form-check-input:focus {
    box-shadow: 0 0 0 0.1rem #fff, 0 0 0 0.25rem rgba(54, 47, 45, 0.25);
}

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

.content-area .invalid {
    outline: 1px solid red;
}

.content-area .validation-message {
    color: red;
}

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

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.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5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) 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: 700;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

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

.brand-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #0f172a;
}

.brand-loading-inline {
    min-height: 160px;
    padding: 20px;
}

.brand-loading-fullscreen {
    position: fixed;
    inset: 0;
    z-index: 4000;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 24px;
    overflow: hidden;
    background: rgba(248, 250, 252, .58);
    pointer-events: all;
}

.brand-loading-blur {
    backdrop-filter: blur(12px) saturate(.9);
}

.brand-loading-card {
    width: auto;
    max-width: min(340px, 82vw);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.brand-loading-logo-shell {
    position: relative;
    width: clamp(132px, 30vw, 220px);
    height: clamp(52px, 10vw, 78px);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.brand-loading-logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.brand-loading-logo-base {
    filter: grayscale(1);
    opacity: .18;
}

.brand-loading-logo-reveal {
    position: absolute;
    inset: 0;
    overflow: hidden;
    width: 100%;
    clip-path: inset(0 100% 0 0);
    animation: brand-logo-reveal 1.9s ease-in-out infinite;
}

.brand-loading-logo-reveal .brand-loading-logo {
    display: block;
}

.brand-loading-fallback {
    width: 54px;
    height: 54px;
    border-radius: 999px;
    border: 3px solid rgba(15, 23, 42, .14);
    border-top-color: rgba(15, 23, 42, .78);
    animation: brand-loading-spin .78s linear infinite;
}

@keyframes brand-logo-reveal {
    0% {
        clip-path: inset(0 92% 0 0);
        opacity: .55;
    }

    55% {
        clip-path: inset(0 0 0 0);
        opacity: 1;
    }

    100% {
        clip-path: inset(0 0 0 0);
        opacity: 1;
    }
}

@keyframes brand-loading-spin {
    to {
        transform: rotate(360deg);
    }
}

@media (prefers-reduced-motion: reduce) {
    .brand-loading-logo-reveal,
    .boot-loading-logo-reveal,
    .brand-loading-fallback,
    .boot-loading-mark {
        animation: none;
    }

    .brand-loading-logo-reveal,
    .boot-loading-logo-reveal {
        clip-path: inset(0 0 0 0);
    }
}

code {
    color: #c02d76;
}

.card {
    border-radius: var(--radius-lg);
    border-color: var(--brand-line);
}

.btn,
.form-control,
.form-select,
.input-group-text,
.alert,
.dropdown-menu {
    border-radius: var(--radius-md);
}

.btn-primary {
    color: #fff;
    background: linear-gradient(180deg, var(--brand-primary) 0%, var(--brand-primary-2) 100%);
    border-color: #2f2826;
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active {
    color: #fff;
    background: linear-gradient(180deg, #2f2927 0%, #443a37 100%);
    border-color: #292220;
}

.auth-shell .btn-primary,
.auth-shell .btn-success {
    color: #fff;
    background: linear-gradient(180deg, var(--brand-primary) 0%, var(--brand-primary-2) 100%);
    border-color: #2f2826;
}

.auth-shell .btn-outline-primary,
.auth-shell .btn-outline-secondary,
.auth-shell .btn-outline-dark {
    border-color: #c8bfbb;
    color: #3e3431;
}

.auth-shell .btn-outline-primary:hover,
.auth-shell .btn-outline-secondary:hover,
.auth-shell .btn-outline-dark:hover {
    color: #fff;
    border-color: var(--brand-primary);
    background: var(--brand-primary);
}

.auth-shell .form-control,
.auth-shell .form-select,
.auth-shell .input-group-text,
.auth-shell .alert {
    border-radius: var(--radius-md);
}

.pricing-source-badge {
    font-weight: 600;
    letter-spacing: 0.01em;
}

.pricing-source-badge-supplier {
    color: #1f2937 !important;
    background-color: #e5e7eb !important;
}

.pricing-source-badge-internal {
    color: #0f172a !important;
    background-color: #bae6fd !important;
}

.pricing-source-badge-stock {
    color: #052e16 !important;
    background-color: #bbf7d0 !important;
}

.pricing-source-badge-hpp {
    color: #422006 !important;
    background-color: #fde68a !important;
}

/* Shared readable chips/badges for mixed themes (avoid white-on-light contrast issues). */
.ux-hint-chip {
    display: inline-block;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    font-size: 12px;
    color: #0f172a !important;
    background: #f8fafc !important;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 2px 6px;
}

.ux-guidance-badge {
    min-width: 86px;
    text-align: center;
    border: 1px solid transparent;
    font-weight: 700;
    letter-spacing: .2px;
}

.ux-guidance-guided {
    background-color: #dcfce7 !important;
    color: #14532d !important;
    border-color: #86efac !important;
}

.ux-guidance-unguided {
    background-color: #fee2e2 !important;
    color: #7f1d1d !important;
    border-color: #fca5a5 !important;
}

/* Drawer submenu links are rendered by NavLink component (<a>) and may bypass scoped CSS selectors. */
.app-shell .drawer .drawer-submenu a,
.app-shell .drawer .drawer-submenu a:link,
.app-shell .drawer .drawer-submenu a:visited {
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 44px;
    padding: 9px 10px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: transparent;
    color: #f2e8e3 !important;
    text-decoration: none !important;
}

.app-shell .drawer .drawer-submenu a:hover {
    background: rgba(255, 255, 255, 0.10);
    border-color: rgba(255, 255, 255, 0.24);
    color: #fff !important;
    text-decoration: none !important;
}

.app-shell .drawer .drawer-submenu a:focus-visible,
.app-shell .drawer .drawer-submenu a:active {
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(255, 255, 255, 0.30);
    color: #fff !important;
    text-decoration: none !important;
    outline: none;
}

.app-shell .drawer .drawer-submenu a.active {
    background: rgba(255, 255, 255, 0.16);
    border-color: rgba(255, 255, 255, 0.34);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.10) inset;
    color: #fff !important;
    text-decoration: none !important;
}

@media (max-width: 900px) {
    .app-shell .drawer .drawer-submenu {
        gap: 8px;
        padding: 0 12px 14px 12px;
    }

    .app-shell .drawer .drawer-submenu a,
    .app-shell .drawer .drawer-submenu a:link,
    .app-shell .drawer .drawer-submenu a:visited {
        min-height: 46px;
        padding: 11px 12px;
    }
}

/* Global readable summary badges (prevent white text on light backgrounds). */
.ux-summary-badge {
    font-weight: 700;
    letter-spacing: .2px;
    border: 1px solid transparent;
}

.ux-summary-badge-dark {
    background: #334155 !important;
    color: #f8fafc !important;
    border-color: #334155 !important;
}

.ux-summary-badge-success {
    background: #dcfce7 !important;
    color: #14532d !important;
    border-color: #86efac !important;
}

.ux-summary-badge-danger {
    background: #fee2e2 !important;
    color: #7f1d1d !important;
    border-color: #fca5a5 !important;
}

.ux-summary-badge-warning {
    background: #fef3c7 !important;
    color: #78350f !important;
    border-color: #fcd34d !important;
}

.ux-summary-badge-secondary {
    background: #e2e8f0 !important;
    color: #1e293b !important;
    border-color: #cbd5e1 !important;
}

.permission-workbench-table,
.permissions-master-table {
    table-layout: fixed;
    width: 100%;
}

.permission-workbench-table th,
.permission-workbench-table td,
.permissions-master-table th,
.permissions-master-table td {
    vertical-align: top;
    word-break: break-word;
}

.permission-workbench-table th:nth-child(1),
.permissions-master-table th:nth-child(1) {
    width: 26%;
}

.permission-workbench-table th:nth-child(2),
.permissions-master-table th:nth-child(2) {
    width: 24%;
}

.permission-workbench-table th:nth-child(3),
.permissions-master-table th:nth-child(3) {
    width: 26%;
}

.permission-workbench-table th:nth-child(4),
.permissions-master-table th:nth-child(4) {
    width: 24%;
}

.permissions-master-table th:nth-child(5) {
    width: 20%;
}

.permission-cell-title {
    font-weight: 700;
    color: #0f172a;
}

.permission-chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.permission-chip {
    display: inline-block;
    white-space: normal;
}

.master-action-stack {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: flex-start;
}

.page-hint-stack {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.page-hint-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

@media (max-width: 991px) {
    .permission-workbench-table,
    .permissions-master-table {
        table-layout: auto;
    }

    .permission-workbench-table thead,
    .permissions-master-table thead {
        display: none;
    }

    .permission-workbench-table tbody,
    .permission-workbench-table tr,
    .permission-workbench-table td,
    .permissions-master-table tbody,
    .permissions-master-table tr,
    .permissions-master-table td {
        display: block;
        width: 100%;
    }

    .permission-workbench-table tr,
    .permissions-master-table tr {
        border: 1px solid #e2e8f0;
        border-radius: 12px;
        padding: 12px;
        margin-bottom: 12px;
        background: #fff;
    }

    .permission-workbench-table td,
    .permissions-master-table td {
        border: 0 !important;
        padding: 6px 0;
    }
}

/* Safety net for bootstrap badges used in legacy pages and older bundled Bootstrap builds. */
.badge.text-bg-primary {
    background-color: #0d6efd !important;
    color: #fff !important;
}

.badge.text-bg-success {
    background-color: #198754 !important;
    color: #fff !important;
}

.badge.text-bg-danger {
    background-color: #dc3545 !important;
    color: #fff !important;
}

.badge.text-bg-secondary {
    background-color: #475569 !important;
    color: #fff !important;
}

.badge.text-bg-dark {
    background-color: #212529 !important;
    color: #fff !important;
}

.badge.text-bg-light {
    background-color: #f8fafc !important;
}

.badge.text-bg-warning {
    background-color: #facc15 !important;
}

.badge.text-bg-info {
    background-color: #67e8f9 !important;
}

.badge.text-bg-light,
.badge.bg-light,
.badge.text-bg-warning,
.badge.bg-warning,
.badge.text-bg-info,
.badge.bg-info {
    color: #1e293b !important;
}

.badge.bg-primary,
.badge.bg-success,
.badge.bg-danger,
.badge.bg-secondary,
.badge.bg-dark {
    color: #fff !important;
}

/* Bootstrap defaults are borderline on the warm app background; keep text AA-readable. */
.text-muted {
    color: #475569 !important;
}

.btn-outline-secondary {
    color: #475569;
    border-color: #94a3b8;
}

.btn-outline-secondary:hover,
.btn-outline-secondary:focus-visible {
    color: #fff;
    background-color: #475569;
    border-color: #475569;
}

.btn-outline-primary {
    color: #0b57d0;
    border-color: #0b57d0;
}

.btn-outline-primary:hover,
.btn-outline-primary:focus-visible {
    color: #fff;
    background-color: #0b57d0;
    border-color: #0b57d0;
}

.btn-outline-warning {
    color: #92400e;
    border-color: #b45309;
}

.btn-outline-warning:hover,
.btn-outline-warning:focus-visible {
    color: #fff;
    background-color: #92400e;
    border-color: #92400e;
}

/* QA browser smoke contrast hardening for disabled outline buttons and Blazor error links. */
.btn-outline-primary:disabled,
.btn-outline-primary.disabled,
.btn-outline-warning:disabled,
.btn-outline-warning.disabled,
.btn-outline-danger:disabled,
.btn-outline-danger.disabled {
    opacity: 1 !important;
    background-color: #fff !important;
}

.btn-outline-primary:disabled,
.btn-outline-primary.disabled {
    color: #0a459f !important;
    border-color: #0a459f !important;
}

.btn-outline-warning:disabled,
.btn-outline-warning.disabled {
    color: #6f2f00 !important;
    border-color: #8a3b00 !important;
}

.btn-outline-danger:disabled,
.btn-outline-danger.disabled {
    color: #9f1d14 !important;
    border-color: #9f1d14 !important;
}

#blazor-error-ui a,
#blazor-error-ui .dismiss {
    color: #0f172a !important;
    font-weight: 700;
    text-decoration: underline;
}
.btn-outline-danger {
    color: #b42318;
    border-color: #b42318;
}

.btn-outline-danger:hover,
.btn-outline-danger:focus-visible {
    color: #fff;
    background-color: #b42318;
    border-color: #b42318;
}
