:root {
    --auth-gold: #c99a2e;
    --auth-gold-dark: #a47a19;
    --auth-gold-light: #fbf1d8;
    --auth-navy: #072a55;
    --auth-text: #0f1623;
    --auth-text-muted: #4a5163;
    --auth-placeholder: #6b7384;
    --auth-border: #e5e7eb;
    --auth-border-light: #e3e6ec;
    --auth-danger: #c0392b;
    --auth-form-border: #f1e1b4;
    --auth-branding-light: #f1f3f7;
    --auth-portal-bg: #f5f8fd;
    --auth-portal-card-width: 1030px;
    --auth-form-panel-width: 658px;
}

html.auth-portal-page,
body.auth-portal-page {
    margin: 0;
    min-height: 100vh;
    font-family: "Be Vietnam Pro", system-ui, -apple-system, sans-serif;
    background: var(--auth-portal-bg) !important;
    background-image: none !important;
    color: var(--auth-text);
}

/* ── Split layout (Login / Register) ── */

.auth-split-page {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

.auth-branding {
    position: relative;
    flex: 1 1 auto;
    min-height: 100vh;
    overflow: hidden;
}

.auth-branding__bg {
    position: absolute;
    inset: 0;
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
}

.auth-branding__overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
}

.auth-branding__content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    padding: 5rem 4rem 3rem;
    min-height: 100vh;
    box-sizing: border-box;
}

.auth-branding__header {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.auth-branding__logo-wrap {
    width: 88px;
    height: 88px;
    border-radius: 16px;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.auth-branding__logo {
    width: 72px;
    height: 72px;
    object-fit: contain;
}

.auth-branding__system {
    margin: 0;
    font-size: 1.125rem;
    line-height: 1.5;
    color: var(--auth-branding-light);
}

.auth-branding__name {
    margin: 0.25rem 0 0;
    font-size: 1.75rem;
    font-weight: 600;
    line-height: 1.25;
    color: #fff;
}

.auth-branding__hero {
    max-width: 41rem;
}

.auth-branding__headline {
    margin: 0 0 1rem;
    font-size: 2.25rem;
    font-weight: 600;
    line-height: 1.2;
    color: #fff;
}

.auth-branding__tagline {
    margin: 0;
    font-size: 1.25rem;
    line-height: 1.65;
    color: var(--auth-branding-light);
}

.auth-feature-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 41rem;
}

.auth-feature-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    border: 1px solid var(--auth-border-light);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.15);
    color: var(--auth-branding-light);
    font-size: 1.125rem;
    font-weight: 500;
    line-height: 1.5;
}

.auth-feature-item__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.5);
    color: #fff;
    flex-shrink: 0;
}

.auth-form-panel {
    flex: 0 0 var(--auth-form-panel-width);
    max-width: var(--auth-form-panel-width);
    display: flex;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(180deg, #fff 0%, #fffbef 100%);
    border-left: 1px solid var(--auth-form-border);
}

.auth-form-panel__inner {
    width: 100%;
    padding: 2.5rem 4rem;
    box-sizing: border-box;
}

.auth-form-title {
    margin: 0 0 0.25rem;
    font-size: 2.25rem;
    font-weight: 600;
    line-height: 1.2;
    color: var(--auth-navy);
}

.auth-form-subtitle {
    margin: 0 0 2rem;
    font-size: 1.125rem;
    line-height: 1.5;
    color: var(--auth-text-muted);
}

.auth-field-label {
    display: block;
    margin-bottom: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--auth-text);
}

.auth-field-label .auth-required {
    color: var(--auth-danger);
}

.auth-input-wrap {
    position: relative;
}

.auth-input-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--auth-placeholder);
    pointer-events: none;
    display: flex;
}

.auth-input-icon--right {
    left: auto;
    right: 0.75rem;
    pointer-events: auto;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    color: var(--auth-placeholder);
}

.auth-input-wrap .form-control {
    padding: 0.5rem 0.75rem 0.5rem 2.25rem;
    min-height: 36px;
    border-radius: 8px;
    border: 1px solid var(--auth-border);
    font-size: 0.875rem;
    color: var(--auth-text);
    background: #fff;
}

.auth-input-wrap .form-control::placeholder {
    color: var(--auth-placeholder);
}

.auth-input-wrap .form-control:focus {
    border-color: var(--auth-gold);
    box-shadow: 0 0 0 0.15rem rgba(201, 154, 46, 0.15);
}

.auth-tenant-select {
    min-height: 36px;
    border-radius: 8px;
    border: 1px solid var(--auth-border);
    font-size: 0.875rem;
    color: var(--auth-text);
    background-color: #fff;
}

.auth-tenant-select:focus {
    border-color: var(--auth-gold);
    box-shadow: 0 0 0 0.15rem rgba(201, 154, 46, 0.15);
}

.auth-input-wrap--password .form-control {
    padding-right: 2.25rem;
}

.auth-form-stack {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.auth-form-actions {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1rem;
}

.auth-options-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.auth-options-row .form-check {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.auth-options-row .form-check-input {
    margin: 0;
    border-color: var(--auth-border);
}

.auth-options-row .form-check-label {
    font-size: 0.875rem;
    color: var(--auth-text);
}

.auth-btn-primary {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 46px;
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 83px 89px 89px 89px;
    background: linear-gradient(265.91deg, #c99a2e 0%, #a47a19 109.91%);
    color: #fff;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
}

.auth-btn-primary:hover,
.auth-btn-primary:focus {
    color: #fff;
    filter: brightness(1.05);
}

.auth-link-gold {
    color: var(--auth-gold);
    text-decoration: none;
    font-weight: 500;
}

.auth-link-gold:hover {
    color: var(--auth-gold-dark);
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    color: var(--auth-placeholder);
    font-size: 0.875rem;
}

.auth-divider::before,
.auth-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--auth-border);
}

.auth-footer-text {
    margin: 0;
    text-align: center;
    font-size: 0.875rem;
    color: var(--auth-text);
}

/* ── SSO Portal (RedirectClient) ── */

.auth-portal-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem 1.25rem 5rem;
    box-sizing: border-box;
}

.auth-portal-shell--sso {
    justify-content: center;
    background: var(--auth-portal-bg);
}

.auth-sso-card {
    width: 100%;
    max-width: var(--auth-portal-card-width);
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 2px 50px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.auth-sso-card__body {
    padding: 2.5rem;
}

.auth-sso-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.auth-sso-brand {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1 1 auto;
    min-width: 0;
}

.auth-sso-brand__logo {
    width: 64px;
    height: 64px;
    object-fit: contain;
    flex-shrink: 0;
}

.auth-sso-brand__title {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
    line-height: 1.5;
    color: var(--auth-text);
}

.auth-sso-brand__subtitle {
    margin: 0.25rem 0 0;
    font-size: 0.875rem;
    line-height: 1.4;
    color: var(--auth-text-muted);
}

.auth-sso-user {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
}

.auth-user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--auth-gold-light);
    color: var(--auth-gold-dark);
    font-size: 1rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.auth-user-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--auth-text);
    line-height: 1.4;
}

.auth-user-email {
    font-size: 0.75rem;
    color: var(--auth-text-muted);
    line-height: 1.4;
}

.auth-search-wrap {
    position: relative;
    margin-bottom: 2rem;
}

.auth-search-wrap .auth-input-icon {
    left: 1rem;
}

.auth-search-wrap .form-control {
    padding: 0.375rem 0.75rem 0.375rem 3rem;
    min-height: 44px;
    border-radius: 103px;
    border: 1px solid var(--auth-border);
    font-size: 1rem;
    background: #fff;
}

.auth-search-wrap .form-control:focus {
    border-color: var(--auth-gold);
    box-shadow: 0 0 0 0.15rem rgba(201, 154, 46, 0.12);
}

.auth-apps-carousel {
    position: relative;
}

.auth-apps-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.5rem;
}

.auth-app-card {
    border: 1px solid var(--auth-border-light);
    border-radius: 8px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-height: 180px;
    background: #fff;
}

.auth-app-card-head {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.auth-app-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #fff;
}

.auth-app-icon--0 {
    background: radial-gradient(circle at center, #004aad 0%, #1a4b8c 100%);
}

.auth-app-icon--1 {
    background: #f97316;
}

.auth-app-icon--2,
.auth-app-icon--3 {
    background: #8b5cf6;
}

.auth-app-card-titles {
    flex: 1;
    min-width: 0;
}

.auth-app-card-title {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
    line-height: 1.4;
    color: var(--auth-text);
}

.auth-app-card-id {
    margin: 0.25rem 0 0;
    font-size: 0.875rem;
    font-style: italic;
    color: var(--auth-text-muted);
}

.auth-app-card-desc {
    margin: 0;
    font-size: 0.875rem;
    line-height: 1.45;
    color: var(--auth-text);
    flex: 1;
}

.auth-app-access-btn {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border: 1px solid var(--auth-gold);
    border-radius: 6px;
    background: var(--auth-gold-light);
    color: var(--auth-gold);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
}

.auth-app-access-btn:hover {
    background: #f5e6c0;
    color: var(--auth-gold-dark);
}

.auth-carousel-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: var(--auth-gold);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    z-index: 2;
}

.auth-carousel-nav:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.auth-carousel-nav--prev {
    left: -16px;
}

.auth-carousel-nav--next {
    right: -16px;
}

.auth-carousel-dots {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1.5rem;
}

.auth-carousel-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: none;
    padding: 0;
    background: #d1d5db;
    cursor: pointer;
}

.auth-carousel-dot.is-active {
    background: var(--auth-gold);
}

.auth-apps-empty {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--auth-text-muted);
    padding: 2rem 1rem;
}

.auth-sso-card__footer {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    padding: 1.5rem 2.5rem;
    background: rgba(242, 246, 252, 0.4);
    flex-wrap: wrap;
}

.auth-sso-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    background: #fff;
    font-size: 0.875rem;
    cursor: pointer;
    text-decoration: none;
}

.auth-sso-btn--manage {
    border: 1px solid var(--auth-text-muted);
    color: var(--auth-text-muted);
}

.auth-sso-btn--logout {
    border: 1px solid var(--auth-danger);
    color: var(--auth-danger);
}

.auth-portal-footer {
    display: flex;
    flex-wrap: wrap;
    gap: 2.5rem;
    justify-content: center;
    align-items: center;
    margin-top: auto;
    padding: 1rem 0;
    font-size: 0.875rem;
}

.auth-portal-footer a {
    color: var(--auth-text-muted);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 400;
}

.auth-portal-footer a:hover {
    color: var(--auth-gold);
}

.auth-all-apps-modal .modal-content {
    border-radius: 14px;
}

.auth-all-apps-modal .auth-apps-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.auth-pagination-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--auth-border);
}

.auth-pagination-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

@media (max-width: 1100px) {
    .auth-split-page {
        flex-direction: column;
    }

    .auth-branding {
        min-height: auto;
    }

    .auth-branding__content {
        min-height: auto;
        padding: 2.5rem 1.5rem;
    }

    .auth-branding__hero,
    .auth-feature-list {
        display: none;
    }

    .auth-form-panel {
        flex: 1 1 auto;
        max-width: none;
        min-height: auto;
        border-left: none;
        border-top: 1px solid var(--auth-form-border);
    }

    .auth-form-panel__inner {
        padding: 2rem 1.5rem;
    }
}

@media (max-width: 768px) {
    .auth-apps-grid,
    .auth-all-apps-modal .auth-apps-grid {
        grid-template-columns: 1fr;
    }

    .auth-sso-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .auth-carousel-nav--prev {
        left: 0;
    }

    .auth-carousel-nav--next {
        right: 0;
    }

    .auth-sso-card__body,
    .auth-sso-card__footer {
        padding: 1.5rem;
    }
}
