/* =========================
   Base
========================= */
html,
body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    font-family: var(--font-family-base);
}

a,
.btn-link {
    color: var(--color-link);
}

.btn-primary {
    color: var(--btn-primary-text);
    background-color: var(--color-btn-primary-bg);
    border-color: var(--color-btn-primary-border);
}

.btn:focus,
.btn:active:focus,
.btn-link.nav-link:focus,
.form-control:focus,
.form-check-input:focus {
    box-shadow: var(--focus-ring);
}

.content {
    padding-top: 1.1rem;
}

h1:focus {
    outline: none;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid var(--color-success-outline);
}

.invalid {
    outline: 1px solid var(--color-danger);
}

.validation-message,
.text-danger.small {
    color: var(--color-danger);
}

.darker-border-checkbox.form-check-input {
    border-color: var(--color-border-strong);
}

.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-floating > label {
    color: var(--color-text-muted);
}

/* =========================
   Error Boundary
========================= */
.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem / 1.8rem, var(--color-danger-dark);
    padding: 1rem 1rem 1rem 3.7rem;
    color: var(--color-error-boundary-text);
}

    .blazor-error-boundary::after {
        content: "An error has occurred.";
    }

/* =========================
   Layout Shells
========================= */
.page-container,
.login-layout-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.content-container {
    flex: 1;
}

.login-main-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    min-height: 0;
    background: radial-gradient(circle at top left, var(--color-primary-bg-soft), transparent 28%), radial-gradient(circle at bottom right, var(--color-primary-border-soft), transparent 30%), linear-gradient(135deg, var(--color-page-bg-start) 0%, var(--color-page-bg-end) 100%);
}

/* =========================
   Login / Auth UI
========================= */
.login-page {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    box-sizing: border-box;
}

.login-card {
    width: var(--login-card-width);
    min-height: var(--login-card-min-height);
    padding: 32px;
    border-radius: var(--radius-xl);
    background: var(--color-surface-glass);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--color-surface-glass-border);
    box-shadow: var(--shadow-card);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.login-card-large {
    width: var(--login-card-width-large);
    max-width: 90%;
}

.login-header {
    text-align: center;
    margin-bottom: 24px;
}

.login-logo {
    max-width: 180px;
    height: auto;
    margin-bottom: 18px;
}

.login-header h1 {
    margin: 0;
    font-size: 2rem;
    font-weight: 700;
    color: var(--color-text-heading);
}

.login-header p {
    margin: 8px 0 0;
    font-size: 0.95rem;
    color: var(--color-text-body);
}

.login-form {
    display: flex;
    flex-direction: column;
}

.login-input {
    min-height: var(--input-height);
    padding-right: 40px;
    border-radius: var(--radius-md) !important;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    box-shadow: none;
}

    .login-input:focus {
        border-color: var(--color-primary);
        box-shadow: 0 0 0 0.2rem var(--color-focus-soft);
    }

.login-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}

.remember-me {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--color-text-dark);
    font-size: 0.94rem;
}

.login-link {
    font-size: 0.92rem;
    color: var(--color-primary-link);
    text-decoration: none;
}

    .login-link:hover {
        text-decoration: underline;
    }

.login-btn {
    width: 100%;
    height: var(--button-height);
    border: none;
    border-radius: var(--radius-md);
    background: var(--btn-primary-bg);
    color: var(--btn-primary-text);
    font-size: 1rem;
    font-weight: 600;
    box-shadow: var(--shadow-button);
    transition: all 0.2s ease;
}

    .login-btn:hover {
        color: var(--btn-primary-text);
        transform: translateY(-1px);
        box-shadow: var(--shadow-button-hover);
    }

.login-divider {
    position: relative;
    text-align: center;
    margin: 18px 0;
}

    .login-divider::before {
        content: "";
        position: absolute;
        top: 50%;
        left: 0;
        right: 0;
        border-top: 1px solid var(--color-border-soft);
        transform: translateY(-50%);
    }

    .login-divider span {
        position: relative;
        display: inline-block;
        padding: 0 12px;
        background: var(--color-surface-glass);
        color: var(--color-divider-text);
        font-size: 0.82rem;
        font-weight: 600;
    }

.passkey-btn {
    width: 100%;
    height: 48px;
    border-radius: var(--radius-md);
    border: 1px solid var(--btn-secondary-border);
    background: var(--btn-secondary-bg);
    color: var(--color-primary-dark) !important;
    font-weight: 600;
    text-decoration: none;
}

    .passkey-btn:hover {
        background: var(--color-surface-soft-hover);
        color: var(--color-primary-dark) !important;
    }

.login-footer-links {
    margin-top: 18px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    text-align: center;
}

    .login-footer-links a {
        color: var(--color-primary-link);
        text-decoration: none;
        font-size: 0.93rem;
    }

        .login-footer-links a:hover {
            text-decoration: underline;
        }

/* =========================
   Password Toggle
========================= */
.password-eye {
    position: absolute;
    top: 18px;
    right: 15px;
    z-index: 10;
    cursor: pointer;
    color: var(--color-icon-muted);
}

    .password-eye:hover,
    .password-toggle-btn:hover {
        color: var(--color-black);
    }

.password-input {
    padding-right: 3rem;
}

.password-toggle-btn {
    position: absolute;
    top: 50%;
    right: 0.75rem;
    z-index: 5;
    transform: translateY(-50%);
    border: none;
    background: transparent;
    padding: 0;
    color: var(--color-icon-muted);
    cursor: pointer;
}

/* =========================
   Footer
========================= */
.app-footer {
    flex-shrink: 0;
    background-color: var(--color-footer-bg) !important;
    border-top: 1px solid var(--color-border) !important;
    padding: 10px 16px !important;
    text-align: center !important;
    font-size: 13px !important;
    color: var(--color-footer-text) !important;
}

    .app-footer .footer-content {
        line-height: 1.5 !important;
    }

    .app-footer a {
        color: var(--color-primary-link) !important;
        text-decoration: none !important;
        margin: 0 6px !important;
        font-weight: 500 !important;
    }

        .app-footer a:hover {
            text-decoration: underline !important;
        }

/* =========================
   Expired / Status UI
========================= */
.expired-state {
    text-align: center;
    padding: 12px 4px 4px;
}

.expired-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 16px;
    border-radius: 50%;
    background: var(--color-warning-bg);
    color: var(--color-warning);
    border: 1px solid var(--color-warning-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    font-weight: 700;
}

.expired-state h2 {
    margin-bottom: 10px;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--color-text-heading);
}

.expired-state p {
    margin-bottom: 18px;
    font-size: 0.95rem;
    color: var(--color-text-body);
}

.expired-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
}

    .expired-actions .login-btn {
        width: 100%;
    }

/* =========================
   MFA Info Box
========================= */
.mfa-info-box {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    padding: 12px 14px;
    border-radius: var(--radius-md);
    background: var(--color-primary-bg-soft);
    border: 1px solid var(--color-primary-border-soft);
    box-shadow: var(--shadow-soft);
}

.mfa-icon {
    font-size: 18px;
    color: var(--color-primary-link);
    flex-shrink: 0;
}

.mfa-message {
    font-size: 0.85rem;
    color: var(--color-primary-text-soft);
    line-height: 1.4;
}

/* =========================
   Error Page
========================= */
.error-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 28px;
    background: radial-gradient(circle at top left, var(--color-primary-bg-soft), transparent 28%), radial-gradient(circle at bottom right, var(--color-primary-border-soft), transparent 30%), linear-gradient(135deg, var(--color-page-bg-start) 0%, var(--color-page-bg-end) 100%);
}

.error-card-modern {
    width: min(980px, 96vw);
    overflow: hidden;
    border-radius: var(--radius-2xl);
    background: var(--color-surface-glass);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--color-surface-glass-border);
    box-shadow: var(--shadow-card);
}

.error-hero {
    display: grid;
    grid-template-columns: 300px 1fr;
    min-height: 480px;
}

.error-icon-panel {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px;
    background: linear-gradient(180deg, var(--color-primary-link) 0%, var(--color-text-heading) 100%);
}

    .error-icon-panel::before {
        content: "";
        position: absolute;
        inset: 24px;
        border-radius: 26px;
        border: 1px solid var(--color-overlay-light);
        background: var(--color-overlay-lighter);
    }

.error-icon-circle {
    position: relative;
    z-index: 1;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: linear-gradient(180deg, var(--color-warning-bg) 0%, var(--color-warning-border) 100%);
    border: 1px solid var(--color-warning-border-strong);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-soft-sm);
}

    .error-icon-circle span {
        font-size: 52px;
        line-height: 1;
        color: var(--color-warning);
    }

.error-content-panel {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 52px 48px;
}

.error-chip {
    display: inline-flex;
    align-self: flex-start;
    margin-bottom: 18px;
    padding: 8px 14px;
    border-radius: var(--radius-round);
    background: var(--color-primary-bg-soft);
    border: 1px solid var(--color-primary-border-soft);
    color: var(--color-primary-text-soft);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.error-content-panel h1 {
    margin: 0 0 14px;
    font-size: 2.35rem;
    font-weight: 700;
    line-height: 1.15;
    color: var(--color-text-heading);
}

.error-text {
    margin: 0 0 26px;
    max-width: 620px;
    font-size: 1.02rem;
    line-height: 1.7;
    color: var(--color-text-body);
}

.request-card {
    margin-bottom: 26px;
    padding: 16px 18px;
    border-radius: var(--radius-lg);
    background: var(--color-surface-soft);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-soft-sm);
}

.request-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.request-label {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--color-primary-text-soft);
}

.request-value {
    font-family: Consolas, "Courier New", monospace;
    font-size: 0.94rem;
    line-height: 1.55;
    color: var(--color-request-value);
    word-break: break-word;
}

.error-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
}

.btn-home-modern,
.btn-back-modern,
.btn-try-modern {
    min-width: 160px;
    height: var(--button-height);
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
}

.btn-home-modern {
    border: none;
    background: var(--btn-primary-bg);
    color: var(--btn-primary-text);
    box-shadow: var(--shadow-button);
}

    .btn-home-modern:hover {
        color: var(--btn-primary-text);
        transform: translateY(-1px);
        box-shadow: var(--shadow-button-hover);
    }

.btn-back-modern {
    border: 1px solid var(--btn-secondary-border);
    background: var(--btn-secondary-bg);
    color: var(--color-primary-dark);
}

    .btn-back-modern:hover {
        background: var(--color-surface-soft-hover);
        color: var(--color-primary-dark);
    }

.btn-try-modern {
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text-dark);
}

    .btn-try-modern:hover {
        background: var(--color-surface-hover-light);
    }

/* =========================
   Password Checklist
========================= */
.password-checklist {
    margin-top: -4px;
    margin-bottom: 14px;
}

.check-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    font-size: 0.92rem;
    line-height: 1.35;
    font-weight: 500;
}

    .check-item:last-child {
        margin-bottom: 0;
    }

    .check-item.bad {
        color: var(--color-danger-soft);
    }

    .check-item.ok {
        color: var(--color-success);
    }

    .check-item i {
        font-size: 0.95rem;
        flex-shrink: 0;
    }

/* =========================
   Lockout
========================= */
.resend-btn {
    background: none;
    border: none;
    padding: 0;
    text-decoration: underline;
    cursor: pointer;
}

    .resend-btn:disabled {
        opacity: 0.7;
        cursor: not-allowed;
        text-decoration: none;
    }

.lockout-progress-wrap {
    width: 100%;
    text-align: center;
}

.lockout-progress-track {
    width: 100%;
    height: 10px;
    background: #f3e8c8;
    border-radius: 999px;
    overflow: hidden;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.08);
}

.lockout-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #f59e0b, #d97706);
    border-radius: 999px;
    transition: width 1s linear;
}

.lockout-progress-label {
    margin-top: 8px;
    font-size: 13px;
    font-weight: 600;
    color: #b45309;
}

/* =========================
   App Shell / Top Navigation
========================= */
.app-shell {
    min-height: 100vh;
    background: radial-gradient(circle at top left, var(--color-primary-bg-soft), transparent 28%), radial-gradient(circle at bottom right, var(--color-primary-border-soft), transparent 30%), linear-gradient(135deg, var(--color-page-bg-start) 0%, var(--color-page-bg-end) 100%);
}

.app-shell__content {
    padding: 24px;
}

.app-shell--layout {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-shell-content--main {
    flex: 1 0 auto;
}

.app-shell--layout > footer,
.app-shell--layout .footer {
    margin-top: auto;
}

.app-topbar {
    position: sticky;
    top: 0;
    z-index: 1200;
    height: 58px;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 16px;
    padding: 0 16px;
    background: var(--color-surface-glass);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--color-surface-glass-border);
    box-shadow: var(--shadow-soft-sm);
}

.app-topbar__left,
.app-topbar__center,
.app-topbar__right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.app-topbar__center--desktop,
.app-topbar__center {
    justify-content: center;
}

.app-topbar__mobile-indicator {
    display: none;
    margin-left: 6px;
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

.app-topbar__brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    border: none;
    background: transparent;
    padding: 0;
    cursor: pointer;
    transition: transform 0.15s ease;
}

    .app-topbar__brand:active {
        transform: scale(0.96);
    }

.app-topbar__logo {
    height: 34px;
    width: auto;
    object-fit: contain;
    display: block;
    border: 0 !important;
    transition: filter 0.2s ease;
}

[data-theme="dark"] .app-topbar__logo {
    filter: brightness(1.2) drop-shadow(0 0 1px rgba(255, 255, 255, 0.35));
}

.app-topbar__title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--color-text-heading);
    white-space: nowrap;
}

    .app-topbar__title strong {
        color: var(--color-primary);
        font-weight: 700;
    }

.topnav-menu {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px;
    border-radius: 999px;
    background: var(--color-surface-glass);
    border: 1px solid var(--color-surface-glass-border);
    box-shadow: var(--shadow-soft-sm);
}

.topnav-item {
    text-decoration: none;
    border: none;
    background: transparent;
    padding: 7px 12px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 0.83rem;
    font-weight: 600;
    color: var(--color-text-dark);
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

    .topnav-item:hover {
        background: var(--color-surface-soft-hover);
        color: var(--color-text-dark);
        text-decoration: none;
    }

    .topnav-item.active {
        background: var(--color-primary-bg-soft);
        color: var(--color-primary) !important;
    }

    .topnav-item i {
        font-size: 0.9rem;
    }

    .topnav-item.active i {
        color: var(--color-primary);
    }

.profile-menu {
    position: relative;
}

.profile-menu__trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 36px;
    padding: 4px 10px 4px 6px;
    border-radius: 999px;
    border: 1px solid var(--color-surface-glass-border);
    background: var(--color-surface);
    color: var(--color-text-heading);
    box-shadow: var(--shadow-soft-sm);
    cursor: pointer;
    transition: all 0.2s ease;
}

    .profile-menu__trigger:hover {
        background: var(--color-primary-bg-soft);
    }

.profile-menu__avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.74rem;
    font-weight: 700;
    flex-shrink: 0;
}

.profile-menu__name {
    max-width: 120px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--color-text-heading);
}

.profile-menu__caret {
    font-size: 0.68rem;
    color: var(--color-text-muted);
}

.profile-menu__dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    width: 230px;
    padding: 8px;
    border-radius: 16px;
    background: var(--color-surface-glass);
    border: 1px solid var(--color-surface-glass-border);
    box-shadow: var(--shadow-soft);
    z-index: 1300;
    animation: fadeSlide 0.18s ease;
}

.profile-menu__item {
    width: 100%;
    border: none;
    background: transparent;
    padding: 12px 14px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--color-text-dark);
    font-size: 0.95rem;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
}

    .profile-menu__item:hover {
        background: var(--color-surface-soft-hover);
    }

.profile-menu__item--danger {
    color: var(--color-danger-soft);
}

    .profile-menu__item--danger:hover {
        background: color-mix(in srgb, var(--color-danger-soft) 8%, transparent);
    }

.profile-menu__overlay {
    position: fixed;
    inset: 0;
    z-index: 1100;
    background: transparent;
}

.mobile-nav-panel {
    position: absolute;
    top: 58px;
    left: 12px;
    right: 12px;
    z-index: 1300;
    padding: 10px;
    border-radius: 16px;
    background: var(--color-surface-glass);
    border: 1px solid var(--color-surface-glass-border);
    box-shadow: var(--shadow-soft);
    animation: fadeSlide 0.18s ease;
}

    .mobile-nav-panel .topnav-menu {
        width: 100%;
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
        padding: 0;
        background: transparent;
        border: none;
        box-shadow: none;
    }

    .mobile-nav-panel .topnav-item {
        width: 100%;
        justify-content: flex-start;
        border-radius: 12px;
        padding: 12px 14px;
    }

        .mobile-nav-panel .topnav-item.active {
            background: var(--color-primary-bg-soft);
        }

.topnav-search {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border-radius: 999px;
    background: var(--color-surface-glass);
    border: 1px solid var(--color-surface-glass-border);
    box-shadow: var(--shadow-soft-sm);
    transition: all 0.2s ease;
}

    .topnav-search:hover {
        background: var(--color-surface);
    }

.topnav-search__icon {
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

.topnav-search__input {
    border: none;
    outline: none;
    background: transparent;
    font-size: 0.82rem;
    width: 180px;
    color: var(--color-text-dark);
}

    .topnav-search__input::placeholder {
        color: var(--color-text-muted);
    }

    .topnav-search__input:focus {
        width: 200px;
        transition: width 0.2s ease;
    }

.topnav-search:focus-within {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px var(--color-primary-bg-soft);
}

/* =========================
   Dashboard
========================= */

.dashboard-header {
    position: relative;
    display: flex;
    align-items: center;
    margin-bottom: 16px;
}

.dashboard-header__left {
    z-index: 1;
}

.dashboard-header__title-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.dashboard-header__welcome {
    margin-top: 4px;
    color: var(--color-text-body);
}

/* 🔥 Center button absolutely */
.dashboard-header__center {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}



/* MOBILE FIX */
@media (max-width: 768px) {

    .dashboard-header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .dashboard-header__center {
        position: static;
        transform: none;
        width: 100%;
    }

    .new-valuation-btn {
        width: 100%;
        text-align: center;
    }
}

.new-valuation-btn {
    font-weight: 600;
    padding: 10px 18px;
    border-radius: 999px;
    white-space: nowrap;
    box-shadow: var(--shadow-soft-sm);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

    .new-valuation-btn:hover {
        transform: translateY(-1px);
        box-shadow: var(--shadow-soft);
    }

.dashboard-gear-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 50%;
    color: var(--color-text-heading);
    background: transparent;
    transition: background 0.2s ease, transform 0.2s ease, color 0.2s ease;
    text-decoration: none;
    padding: 0;
}

    .dashboard-gear-btn i {
        font-size: 1.1rem;
        line-height: 1;
    }

    .dashboard-gear-btn:hover {
        background: var(--color-primary-bg-soft);
        color: var(--color-primary);
        transform: rotate(30deg);
    }

    .dashboard-gear-btn:focus-visible {
        outline: 2px solid var(--color-primary);
        outline-offset: 2px;
    }



.dashboard-page {
    display: flex;
    flex-direction: column;
    margin: 15px;
}

    .dashboard-page h1 {
        margin: 0;
        color: var(--color-text-heading);
        font-size: 2rem;
        font-weight: 700;
    }

    .dashboard-page p {
        margin: 0;
        color: var(--color-text-body);
        font-size: 0.75rem;
        max-width: 720px;
    }

.dashboard-page-center {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 150px);
}

.grid-stack {
    width: 100%;
}

.grid-stack-item-content {
    position: absolute;
    inset: 8px;
    border-radius: 16px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-soft-sm);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
/* mobile polish */
@media (max-width: 768px) {
    .grid-stack-item {
        margin-bottom: 8px;
    }

    .dashboard-widget-card {
        display: flex;
        flex-direction: column;
    }

    .dashboard-widget-card__body {
        flex: 1;
    }
}

/* Hide old default handle icon styling */
.grid-stack .ui-resizable-handle {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}



/* Hide only the top-side handles — resizing "up" from the origin doesn't
   make sense in a grid layout and would confuse users. */
.grid-stack .ui-resizable-n,
.grid-stack .ui-resizable-ne,
.grid-stack .ui-resizable-nw {
    display: none !important;
}

/* Bottom-right corner — primary handle. Larger 44px target that's always
   partly visible so users don't have to hover to discover it. */
.grid-stack .ui-resizable-se {
    width: 44px !important;
    height: 44px !important;
    right: 2px !important;
    bottom: 2px !important;
    cursor: nwse-resize !important;
    background: transparent !important;
    border: 0 !important;
    opacity: 0.55;
    transition: opacity 0.18s ease, transform 0.18s ease;
    z-index: 5;
    pointer-events: auto;
}

/* Bottom-left corner — same size and always-partly-visible treatment. */
.grid-stack .ui-resizable-sw {
    width: 44px !important;
    height: 44px !important;
    left: 2px !important;
    bottom: 2px !important;
    cursor: nesw-resize !important;
    background: transparent !important;
    border: 0 !important;
    opacity: 0.55;
    transition: opacity 0.18s ease, transform 0.18s ease;
    z-index: 5;
    pointer-events: auto;
}

/* Right edge — thicker strip (16px) along the middle 70% of the widget. */
.grid-stack .ui-resizable-e {
    width: 16px !important;
    right: -2px !important;
    top: 15% !important;
    bottom: 15% !important;
    cursor: ew-resize !important;
    background: transparent !important;
    border: 0 !important;
    opacity: 0;
    transition: opacity 0.18s ease, background-color 0.18s ease;
    z-index: 5;
    pointer-events: auto;
}

/* Left edge — resizing from here shifts the widget's origin. */
.grid-stack .ui-resizable-w {
    width: 16px !important;
    left: -2px !important;
    top: 15% !important;
    bottom: 15% !important;
    cursor: ew-resize !important;
    background: transparent !important;
    border: 0 !important;
    opacity: 0;
    transition: opacity 0.18s ease, background-color 0.18s ease;
    z-index: 5;
    pointer-events: auto;
}

/* Bottom edge. */
.grid-stack .ui-resizable-s {
    height: 16px !important;
    bottom: -2px !important;
    left: 15% !important;
    right: 15% !important;
    cursor: ns-resize !important;
    background: transparent !important;
    border: 0 !important;
    opacity: 0;
    transition: opacity 0.18s ease, background-color 0.18s ease;
    z-index: 5;
    pointer-events: auto;
}

/* Fully reveal every enabled handle on widget hover or when actively
   resizing. Corners are already at 0.55 opacity, so this just brightens
   them; edges are 0 by default and become fully visible here. */
.grid-stack-item:hover .ui-resizable-se,
.grid-stack-item:hover .ui-resizable-sw,
.grid-stack-item:hover .ui-resizable-e,
.grid-stack-item:hover .ui-resizable-w,
.grid-stack-item:hover .ui-resizable-s,
.grid-stack-item.ui-resizable-resizing .ui-resizable-se,
.grid-stack-item.ui-resizable-resizing .ui-resizable-sw,
.grid-stack-item.ui-resizable-resizing .ui-resizable-e,
.grid-stack-item.ui-resizable-resizing .ui-resizable-w,
.grid-stack-item.ui-resizable-resizing .ui-resizable-s,
.grid-stack-item:focus-within .ui-resizable-se,
.grid-stack-item:focus-within .ui-resizable-sw,
.grid-stack-item:focus-within .ui-resizable-e,
.grid-stack-item:focus-within .ui-resizable-w,
.grid-stack-item:focus-within .ui-resizable-s {
    opacity: 1;
}

/* Highlight the edge strip when hovered directly. */
.grid-stack .ui-resizable-e:hover,
.grid-stack .ui-resizable-w:hover,
.grid-stack .ui-resizable-s:hover {
    background-color: rgba(37, 99, 235, 0.28) !important;
    border-radius: 4px;
}

/* Modern diagonal grip on the bottom-right corner. Confined to the bottom-
   right 20px of the 44px handle so the visible glyph stays a normal size
   while the invisible hit area is much larger. */
.grid-stack .ui-resizable-se::before {
    content: "";
    position: absolute;
    right: 4px;
    bottom: 4px;
    width: 20px;
    height: 20px;
    border-radius: 4px;
    background: linear-gradient(135deg, transparent 0 42%, var(--color-primary, #2563eb) 42% 52%, transparent 52% 100%), linear-gradient(135deg, transparent 0 60%, var(--color-primary, #2563eb) 60% 70%, transparent 70% 100%), linear-gradient(135deg, transparent 0 78%, var(--color-primary, #2563eb) 78% 88%, transparent 88% 100%);
    opacity: 0.75;
    pointer-events: none;
}

/* Mirrored grip on the bottom-left corner. */
.grid-stack .ui-resizable-sw::before {
    content: "";
    position: absolute;
    left: 4px;
    bottom: 4px;
    width: 20px;
    height: 20px;
    border-radius: 4px;
    background: linear-gradient(45deg, transparent 0 42%, var(--color-primary, #2563eb) 42% 52%, transparent 52% 100%), linear-gradient(45deg, transparent 0 60%, var(--color-primary, #2563eb) 60% 70%, transparent 70% 100%), linear-gradient(45deg, transparent 0 78%, var(--color-primary, #2563eb) 78% 88%, transparent 88% 100%);
    opacity: 0.75;
    pointer-events: none;
}

/* Corner glyph gets brighter on hover so the growing hit area feels active. */
.grid-stack-item:hover .ui-resizable-se::before,
.grid-stack-item:hover .ui-resizable-sw::before {
    opacity: 1;
}

/* Slight scale bump on direct hover of the corner. */
.grid-stack .ui-resizable-se:hover,
.grid-stack .ui-resizable-sw:hover {
    transform: scale(1.1);
}


/* optional: card highlight while resizing */
.grid-stack-item.ui-resizable-resizing .dashboard-widget-card {
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.12), 0 14px 34px rgba(0, 0, 0, 0.12);
}


.dashboard-widget-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-soft);
}

.dashboard-widget-card__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    font-weight: 700;
    color: var(--color-text-heading);
    border-bottom: 1px solid var(--color-border-soft);
    background: linear-gradient(to right, var(--color-surface-soft), var(--color-primary-bg-soft));
}

.dashboard-widget-card__title-link {
    color: var(--color-primary);
    transition: color 120ms ease, filter 120ms ease;
}

.dashboard-widget-card__title-link:hover {
    color: var(--color-primary-hover, var(--color-primary));
    filter: brightness(1.15);
    text-decoration: underline;
    text-decoration-style: dotted;
    text-underline-offset: 3px;
}

.dashboard-widget-card__title-link:hover i.bi-arrow-clockwise {
    transform: rotate(90deg);
    transition: transform 200ms ease;
}

.dashboard-widget-card {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.dashboard-widget-card__body {
    flex: 1;
    padding: 16px;
    display: flex;
    flex-direction: column;
}


/*
.widget-label {
    font-size: 0.95rem;
    color: #6c757d;
    margin-bottom: 0.4rem;
}*/

/*.widget-value {
    font-size: 2rem;
    font-weight: 700;
    color: #212529;
}*/

/*.drag-icon {
    cursor: move;
    font-size: 1.1rem;
    opacity: 0.7;
    pointer-events: none;
}*/

.dashboard-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(10, 18, 31, 0.38);
    backdrop-filter: blur(4px);
    opacity: 0;
    animation: backdropFade 0.2s ease forwards;
    z-index: 1040;
}

.dashboard-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    width: min(720px, 95vw);
    max-height: 85vh;
    overflow: hidden;
    transform: translate(-50%, -50%) scale(0.96);
    opacity: 0;
    background: var(--color-surface-glass);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--color-surface-glass-border);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-card);
    z-index: 1050;
    animation: modalFadeIn 0.22s ease forwards;
}

.dashboard-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 22px;
    border-bottom: 1px solid var(--color-border);
    background: linear-gradient( to right, var(--color-primary-bg-soft), rgba(255, 255, 255, 0.72) );
}

    .dashboard-modal__header h5 {
        margin: 0;
        font-size: 1.05rem;
        font-weight: 700;
        color: var(--color-text-heading);
    }

.dashboard-modal__body {
    padding: 20px 22px;
    max-height: calc(85vh - 138px);
    overflow-y: auto;
    background: transparent;
}

    .dashboard-modal__body p {
        color: var(--color-text-body);
        font-size: 0.92rem;
    }

.dashboard-modal__footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 22px;
    border-top: 1px solid var(--color-border);
    background: rgba(255, 255, 255, 0.55);
}

.config-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    padding: 14px 16px;
    margin-bottom: 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    background: var(--color-surface);
    box-shadow: var(--shadow-soft-sm);
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

    .config-item:hover {
        transform: translateY(-1px);
        box-shadow: var(--shadow-soft);
        border-color: var(--color-primary-border-soft);
    }

    .config-item:last-child {
        margin-bottom: 0;
    }

.config-item__left {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}

    .config-item__left strong {
        font-size: 0.96rem;
        font-weight: 700;
        color: var(--color-text-heading);
        line-height: 1.4;
    }

.config-item__desc {
    margin-top: 4px;
    font-size: 0.83rem;
    color: var(--color-text-muted);
    line-height: 1.45;
    word-break: break-word;
}

.config-item__right {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    min-height: 100%;
}

.dashboard-modal .form-check.form-switch {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.dashboard-modal .form-check-input {
    cursor: pointer;
}

.dashboard-modal .form-check-label {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--color-text-dark);
    cursor: pointer;
    margin-bottom: 0;
}

.dashboard-modal .btn-close {
    opacity: 0.8;
    transition: transform 0.18s ease, opacity 0.18s ease;
}

    .dashboard-modal .btn-close:hover {
        opacity: 1;
        transform: scale(1.05);
    }

@media (max-width: 768px) {
    .dashboard-modal {
        width: min(94vw, 94vw);
        max-height: 88vh;
        border-radius: var(--radius-xl);
    }

    .dashboard-modal__header,
    .dashboard-modal__body,
    .dashboard-modal__footer {
        padding-left: 16px;
        padding-right: 16px;
    }

    .config-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .config-item__right {
        width: 100%;
        justify-content: flex-start;
        margin-top: 4px;
    }

    .dashboard-modal__footer {
        flex-direction: column;
    }

        .dashboard-modal__footer .btn {
            width: 100%;
        }
}

@keyframes backdropFade {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: translate(-50%, -48%) scale(0.96);
    }

    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

/* =========================
   Toast Host
========================= */
.app-toast-overlay {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    background: rgba(10, 18, 31, 0.22);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

.app-toast {
    width: min(92vw, 420px);
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 18px 18px 16px;
    border-radius: 18px;
    background: rgba(17, 24, 39, 0.96);
    color: #f8fafc;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 22px 70px rgba(0, 0, 0, 0.35);
    animation: toastFadeZoom 0.2s ease;
}

.app-toast__icon {
    font-size: 1.2rem;
    line-height: 1;
    margin-top: 2px;
    flex-shrink: 0;
}

.app-toast__body {
    flex: 1;
    min-width: 0;
}

.app-toast__title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 4px;
    color: #fff;
}

.app-toast__message {
    font-size: 0.92rem;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.84);
}

.app-toast__close {
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.72);
    cursor: pointer;
    padding: 0;
    line-height: 1;
    font-size: 0.95rem;
    flex-shrink: 0;
}

    .app-toast__close:hover {
        color: #fff;
    }

.app-toast--success .app-toast__icon {
    color: #22c55e;
}

.app-toast--error .app-toast__icon {
    color: #ef4444;
}

.app-toast--warning .app-toast__icon {
    color: #f59e0b;
}

.app-toast--info .app-toast__icon {
    color: #38bdf8;
}

/* =========================
   Animations
========================= */
@keyframes fadeSlide {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes toastFadeZoom {
    from {
        opacity: 0;
        transform: translateY(8px) scale(0.97);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* =========================
   Responsive
========================= */
@media (max-width: 1100px) {
    .app-topbar {
        grid-template-columns: auto 1fr;
    }

    .app-topbar__center {
        display: none;
    }

    .app-topbar__right {
        justify-content: flex-end;
    }

    .app-topbar__mobile-indicator {
        display: inline-flex;
        align-items: center;
    }

    .topnav-search {
        display: none;
    }
}

@media (max-width: 900px) {
    .error-hero {
        grid-template-columns: 1fr;
    }

    .error-icon-panel {
        min-height: 220px;
    }

    .error-content-panel {
        padding: 34px 24px;
    }

        .error-content-panel h1 {
            font-size: 1.95rem;
        }

    .profile-menu__name {
        display: none;
    }
}

@media (max-width: 768px) {
    .config-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .config-item__right {
        width: 100%;
        justify-content: space-between;
    }

    .width-select {
        width: 100%;
        max-width: 180px;
    }

    .app-topbar__title,
    .profile-menu__name {
        display: none;
    }
}

@media (max-width: 576px) {
    .login-card {
        width: 100%;
        min-height: auto;
        padding: 24px 18px;
        border-radius: var(--radius-lg);
    }

    .login-logo {
        max-width: 150px;
    }

    .login-header h1 {
        font-size: 1.7rem;
    }

    .login-options {
        flex-direction: column;
        align-items: flex-start;
    }

    .error-shell {
        padding: 16px;
    }

    .error-card-modern {
        border-radius: 22px;
    }

    .error-content-panel h1 {
        font-size: 1.7rem;
    }

    .error-actions {
        flex-direction: column;
    }

    .btn-home-modern,
    .btn-back-modern,
    .btn-try-modern {
        width: 100%;
    }

    .request-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .app-topbar {
        height: 70px;
        padding: 0 16px;
    }

    .app-topbar__logo {
        height: 36px;
    }



    .profile-menu__dropdown {
        width: 210px;
    }
}


.order-chart-card {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    height: 100%;
    width: 100%;
    min-height: 0;
}

.order-chart-body {
    flex: 1 1 auto;
    width: 100%;
    min-height: 0;
    position: relative;
}

    .order-chart-body canvas {
        width: 100% !important;
        height: 100% !important;
        display: block;
    }


.input-group-sm .input-group-text {
    width: 34px;
    justify-content: center;
    color: var(--color-text-muted);
    background: var(--color-surface-soft);
    border-color: var(--color-border);
}

.input-group-sm .form-control,
.input-group-sm .form-select {
    min-height: 32px;
    font-size: 0.8rem;
    border-color: var(--color-border);
}

.form-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--color-text-muted);
}

/* Valuation order form */
.valuation-field {
    flex: 0 0 auto;
    width: 240px;
}

    .valuation-field .input-group {
        flex-wrap: nowrap;
        align-items: stretch;
    }

    .valuation-field .form-select,
    .valuation-field .form-control {
        min-width: 0;
    }

    .valuation-field .input-group > .input-group-text {
        align-self: stretch;
        padding-top: 0;
        padding-bottom: 0;
    }

.contact-card,
.bulk-widget-card {
    border: 1px solid var(--color-border);
    background: var(--color-surface-soft);
    border-radius: 8px;
    padding: 8px 10px;
}

.contact-card {
    flex: 0 0 auto;
    width: 280px;
}

.valuation-subheader {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--color-text-heading);
    padding-top: 5px;
    letter-spacing: 0.04em;
    padding-bottom: 4px;
    margin-bottom: 8px;
    border-bottom: 1px solid var(--color-border);
}

@media (max-width: 575.98px) {
    .valuation-field {
        width: 100%;
    }
}

/* Bulk order / bulk summary shared */
.bulk-step-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--color-primary-bg-soft);
    color: var(--color-primary-text-soft);
    font-weight: 600;
    font-size: 0.78rem;
    margin-right: 6px;
    border: 1px solid var(--color-primary-border-soft);
}

.bulk-mapping-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px 16px;
}

@media (max-width: 992px) {
    .bulk-mapping-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 576px) {
    .bulk-mapping-grid {
        grid-template-columns: 1fr;
    }
}

.bulk-mapping-cell {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.bulk-review-card {
    border: 1px solid var(--color-border);
    background: var(--color-surface-soft);
    border-radius: 10px;
    padding: 10px 12px;
    height: 100%;
}

.bulk-review-card__label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-text-muted);
    margin-bottom: 2px;
}

.bulk-review-card__value {
    font-weight: 600;
    color: var(--color-text-heading);
    word-break: break-word;
}

.bulk-grid--compact th,
.bulk-grid--compact td {
    padding: 2px 6px !important;
    font-size: 0.72rem !important;
    line-height: 1.25 !important;
}

.bulk-grid--compact .form-control,
.bulk-grid--compact .form-control-sm {
    font-size: 0.72rem !important;
    padding: 2px 4px !important;
    min-height: 0 !important;
    height: auto !important;
}

.bulk-grid--compact .btn {
    padding: 0 4px !important;
    font-size: 0.72rem !important;
    line-height: 1.25 !important;
}

.bulk-refresh-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, #0d6efd 0%, #00c853 100%);
    color: #fff;
    font-size: 0.85rem;
    line-height: 1;
    box-shadow: 0 0 8px rgba(13, 110, 253, 0.55);
    cursor: pointer;
    transition: transform 120ms ease, box-shadow 120ms ease, filter 120ms ease;
}

.bulk-refresh-btn:hover:not(:disabled) {
    transform: rotate(90deg);
    filter: brightness(1.15);
    box-shadow: 0 0 12px rgba(0, 200, 83, 0.65);
}

.bulk-refresh-btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

/* Bulk placement widget */
.bulk-widget-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 8px;
}

.bulk-widget-stat {
    flex: 1;
    text-align: center;
    border-radius: 4px;
    padding: 3px 4px;
}

.bulk-widget-stat__label {
    font-size: 0.6rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    opacity: 0.95;
}

.bulk-widget-stat__value {
    font-size: 1rem;
    font-weight: 800;
    line-height: 1.1;
}

.bulk-widget-link {
    color: var(--color-primary) !important;
    text-decoration: underline;
    text-decoration-style: dotted;
    text-underline-offset: 3px;
    font-size: 0.82rem;
    cursor: pointer;
}

.bulk-widget-link:hover {
    color: var(--color-primary-hover, var(--color-primary)) !important;
    text-decoration-style: solid;
    filter: brightness(1.15);
}

@media (max-width: 576px) {
    .card-body {
        padding: 0.75rem !important;
    }

    .btn-sm {
        min-height: 34px;
    }
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 9px;
    border-radius: 999px;
    background: var(--color-primary-bg-soft);
    color: var(--color-primary-text-soft);
    font-size: 0.78rem;
    font-weight: 600;
}

.chip-remove {
    border: 0;
    background: transparent;
    color: inherit;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    padding: 0;
}

.saved-search-menu {
    max-height: 280px;
    overflow-y: auto;
}

.saved-search-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 6px;
    border-radius: 8px;
}

    .saved-search-item:hover {
        background: var(--color-surface-soft-hover);
    }

.saved-search-item--selected {
    background: var(--color-primary-bg-soft);
}

.icon-btn {
    border: 0;
    background: transparent;
    padding: 2px 4px;
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

/* Reusable Portal Grid */
.portal-grid {
    width: 100%;
    font-size: var(--portal-grid-font-size, 0.8rem);
}

    .portal-grid th {
        background: var(--color-primary, #154d7d) !important;
        color: var(--color-white, #fff) !important;
        text-align: center;
        font-weight: 700;
        padding: var(--portal-grid-header-padding, 0.5rem);
        white-space: nowrap;
    }

        .portal-grid th button {
            color: inherit !important;
            font-weight: 700;
            background: transparent;
            border: none;
        }

    .portal-grid td {
        padding: var(--portal-grid-cell-padding, 0.35rem 0.5rem);
        vertical-align: middle;
        text-align: center;
        border-bottom: 1px solid var(--color-border, #e5e7eb);
    }

    .portal-grid tbody tr:hover {
        background-color: var(--color-surface-soft-hover);
    }

.portal-grid--no-pointer tbody tr,
.portal-grid--no-pointer tbody tr:hover {
    cursor: default !important;
}

/* Rows whose status column contains a .status-cancelled badge render every
   cell (and any nested link) in red. Uses :has() so the marker class lives
   on a single element (the status badge) and no per-column wrapping is
   needed. Modern-browser only — Chrome/Edge 105+, Firefox 121+, Safari 15.4+. */
.portal-grid tbody tr:has(.status-cancelled) td,
.portal-grid tbody tr:has(.status-cancelled) td a {
    color: var(--bs-danger, #dc3545) !important;
}

/* Utility */
.portal-clickable {
    cursor: pointer;
}

    .portal-clickable:hover {
        text-decoration: underline;
    }

/* Loader */
.portal-loader-overlay {
    position: fixed;
    inset: 0;
    background: var(--color-surface-glass);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.portal-loader-inline {
    min-height: 220px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.portal-loader-card {
    text-align: center;
    background: var(--color-surface, #fff);
    padding: 1rem 1.25rem;
    border-radius: 1rem;
    box-shadow: 0 8px 24px rgba(0,0,0,0.10);
}

/* BlazorBootstrap Grid Pager */
ul.pagination {
    margin-bottom: 0 !important;
    gap: 3px;
}

ul.pagination .page-link {
    border-radius: 6px !important;
    font-size: 0.78rem !important;
    line-height: 1 !important;
    min-width: 28px !important;
    width: 28px !important;
    height: 28px !important;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    color: var(--color-primary) !important;
    border: 1px solid var(--color-border) !important;
}

ul.pagination .page-link i,
ul.pagination .page-link svg {
    font-size: 0.8rem !important;
    width: 0.85rem;
    height: 0.85rem;
}

ul.pagination .page-item.active .page-link {
    background: var(--color-primary) !important;
    border-color: var(--color-primary) !important;
    color: #fff !important;
    font-weight: 700;
}

ul.pagination .page-item.disabled .page-link {
    background: var(--color-surface-soft) !important;
    color: var(--color-text-muted) !important;
}

.bb-grid-pagination-text {
    font-size: 0.78rem !important;
    margin-left: 0.6rem;
}

/* Page-size select sits next to the pagination ul in the grid footer */
ul.pagination ~ select.form-select,
ul.pagination + select.form-select,
*:has(> ul.pagination) select.form-select,
*:has(> .bb-grid-pagination-text) select.form-select,
select.form-select.form-select-sm {
    height: 28px !important;
    min-height: 28px !important;
    font-size: 0.78rem !important;
    padding: 0 1.6rem 0 0.6rem !important;
    border-radius: 6px !important;
    line-height: 1 !important;
    width: auto !important;
    min-width: 60px !important;
    margin-right: 0.6rem;
}

/* =========================
   Order View Page
========================= */
.order-view-page {
    padding: 20px;
    max-width: 1400px;
    margin: 0 auto;
}

.order-breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    color: var(--color-text-muted);
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.order-breadcrumb a {
    color: var(--color-primary-link);
    text-decoration: none;
}

.order-breadcrumb a:hover {
    text-decoration: underline;
}

.order-breadcrumb__separator {
    font-size: 0.7rem;
    color: var(--color-text-muted);
}

.order-page-header {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 16px;
    margin-bottom: 20px;
    min-height: 52px;
}

.order-page-header__left {
    z-index: 1;
}

.order-page-header__center {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}

.order-page-header__title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-text-heading);
    margin: 0;
    line-height: 1.25;
}

.order-page-header__subtitle {
    font-size: 0.88rem;
    color: var(--color-text-muted);
    margin-top: 5px;
}

/* Status Badges */
.order-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.order-status-badge--info {
    background: var(--color-primary-bg-soft);
    color: var(--color-primary-text-soft);
    border: 1px solid var(--color-primary-border-soft);
}

.order-status-badge--success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #6ee7b7;
}

.order-status-badge--warning {
    background: var(--color-warning-bg);
    color: var(--color-warning);
    border: 1px solid var(--color-warning-border);
}

.order-status-badge--danger {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

.order-status-badge--secondary {
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
}

/* Info Cards Grid */
.order-info-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.order-info-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-soft-sm);
    overflow: hidden;
}

.order-info-card__header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: linear-gradient(to right, var(--color-primary-bg-soft), rgba(255, 255, 255, 0.6));
    border-bottom: 1px solid var(--color-border);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-primary-text-soft);
}

.order-info-card__body {
    padding: 12px 16px;
}

.order-info-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 0;
    border-bottom: 1px solid var(--color-border-soft);
}

.order-info-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.order-info-row__label {
    font-size: 0.73rem;
    font-weight: 600;
    color: var(--color-text-muted);
    white-space: nowrap;
    flex-shrink: 0;
    min-width: 88px;
}

.order-info-row__value {
    font-size: 0.83rem;
    font-weight: 500;
    color: var(--color-text-dark);
    text-align: right;
    word-break: break-word;
}

.order-info-row__value--na {
    font-size: 0.82rem;
    color: var(--color-text-muted);
    font-style: italic;
}

/* Action Bar */
.order-action-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.order-action-bar__primary {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.order-action-bar__secondary {
    display: flex;
    gap: 8px;
    margin-left: auto;
    flex-wrap: wrap;
}

/* Tabs */
.order-tab-link {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--color-text-muted);
    border: none !important;
    border-bottom: 2px solid transparent !important;
    border-radius: 0 !important;
    padding: 8px 14px;
    background: transparent !important;
    transition: color 0.15s ease, border-color 0.15s ease;
}

.order-tab-link:hover {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary-border-soft) !important;
}

.order-tab-link.active {
    color: var(--color-primary) !important;
    border-bottom-color: var(--color-primary) !important;
    background: transparent !important;
}

/* Responsive */
@media (max-width: 992px) {
    .order-info-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 640px) {
    .order-info-grid {
        grid-template-columns: 1fr;
    }

    .order-action-bar__secondary {
        margin-left: 0;
        width: 100%;
    }

    .order-page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .order-page-header__center {
        position: static;
        transform: none;
        width: 100%;
        justify-content: flex-start;
    }

    .order-page-header__title {
        font-size: 1.2rem;
    }

    .order-view-page {
        padding: 14px;
    }
}

/* =========================
   Searchable select (combobox)
========================= */
.searchable-select {
    position: relative;
    width: 100%;
    /* Outer wrapper is focusable via tabindex="-1" so we can catch focusout
       when focus moves between the input and the option list. */
    outline: none;
}

.searchable-select__input-wrap {
    position: relative;
}

.searchable-select__input {
    padding-right: 26px;
}

.searchable-select__caret {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: var(--color-text-muted, #6c757d);
    font-size: 0.85rem;
}

.searchable-select--disabled .searchable-select__caret {
    opacity: 0.5;
}

.searchable-select__menu {
    position: absolute;
    top: calc(100% + 2px);
    left: 0;
    right: 0;
    z-index: 20;
    max-height: 220px;
    overflow-y: auto;
    margin: 0;
    padding: 4px 0;
    list-style: none;
    background: var(--color-surface, #fff);
    border: 1px solid var(--color-border, #ced4da);
    border-radius: 6px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
    font-size: 0.85rem;
}

.searchable-select__option {
    padding: 6px 12px;
    cursor: pointer;
    color: var(--color-text-body, #212529);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.searchable-select__option:hover,
.searchable-select__option.is-active {
    background-color: var(--color-primary-bg-soft, rgba(37, 99, 235, 0.10));
    color: var(--color-primary, #2563eb);
}

.searchable-select__empty {
    padding: 6px 12px;
    color: var(--color-text-muted, #6c757d);
    font-style: italic;
}

/* =========================
   Impersonation — modal + banner
========================= */

/* Modal backdrop covers the whole viewport; click anywhere outside the card cancels. */
.impersonate-modal__backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 10500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.impersonate-modal {
    background: var(--color-surface, #fff);
    color: var(--color-text-body, #222);
    border: 1px solid var(--color-border, #ddd);
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
    width: 100%;
    max-width: 460px;
    font-family: inherit;
    display: flex;
    flex-direction: column;
    max-height: 90vh;
    overflow: hidden;
}

.impersonate-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid var(--color-border-soft, #eee);
    background: linear-gradient(to right, var(--color-surface-soft, #f7f7fa), var(--color-primary-bg-soft, #eef4ff));
}

.impersonate-modal__body {
    padding: 16px 18px;
    overflow-y: auto;
}

.impersonate-modal__footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 18px;
    border-top: 1px solid var(--color-border-soft, #eee);
}

/* Impersonation banner sits above every page while an admin is acting as another
   user. Non-dismissable — the only exit is the button on the right side. Sticky
   so it never scrolls out of view. */
.impersonation-banner {
    position: sticky;
    top: 0;
    /* Below .app-topbar (z-index 1200) and its profile dropdown so the
       dropdown draws over the banner cleanly. Above regular page content. */
    z-index: 900;
    background: linear-gradient(90deg, #fff4c2, #ffe08a);
    border-bottom: 2px solid #d4a017;
    color: #4a3500;
    font-size: 0.9rem;
    line-height: 1.35;
}

.impersonation-banner__inner {
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 1400px;
    margin: 0 auto;
    padding: 10px 18px;
    flex-wrap: wrap;
}

.impersonation-banner__icon {
    color: #b8860b;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.impersonation-banner__text {
    flex: 1;
    min-width: 0;
}

.impersonation-banner__exit {
    background: #4a3500;
    color: #fff4c2;
    border: 0;
    border-radius: 6px;
    padding: 6px 14px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
    transition: filter 0.15s ease;
}

.impersonation-banner__exit:hover:not(:disabled) {
    filter: brightness(1.15);
}

.impersonation-banner__exit:disabled {
    opacity: 0.7;
    cursor: default;
}


/* ===== EULA */
.eula-page {
    max-width: 820px;
    margin: 0 auto;
    padding: 32px 24px 48px;
    background: #fff;
    color: #222;
    font-family: Calibri, "Segoe UI", Arial, sans-serif;
    font-size: 1rem;
    line-height: 1.5;
}

.eula-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    padding-bottom: 12px;
    margin-bottom: 24px;
    border-bottom: 3px solid #000;
}

.eula-logo {
    height: 90px;
    width: auto;
    max-width: 100%;
}

.eula-title {
    margin: 0;
    font-size: 2rem;
    font-weight: 700;
    color: #000;
}

.eula-page h2 {
    margin: 24px 0 10px;
    font-size: 1.5rem;
    font-weight: 700;
    color: #595959;
}

.eula-page h3 {
    margin: 16px 0 6px;
    font-size: 1.05rem;
    font-weight: 700;
    font-style: italic;
    color: #4f81bd;
    font-family: Cambria, Georgia, serif;
}

.eula-page p {
    margin: 0 0 12px;
}

.eula-page ul {
    margin: 0 0 12px;
    padding-left: 28px;
}

.eula-page a {
    color: #0563c1;
    text-decoration: underline;
}

.eula-updated {
    margin-top: 32px;
    font-size: 0.95rem;
}

@media (max-width: 600px) {
    .eula-title {
        font-size: 1.5rem;
    }

    .eula-logo {
        height: 64px;
    }
}
