/* ==========================================================================
   AEO Registration Portal - Comprehensive Responsive Styles (RTL)
   Complete Overhaul: Zero Field Overlaps, Clean Typography, Mobile First
   ========================================================================== */

/* Self-hosted Tajawal: Arabic and Latin subsets, served through JSF resources. */
@font-face {
    font-family: "Tajawal";
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url("/AEO/javax.faces.resource/Tajawal-Regular-Arabic.woff2.xhtml?ln=fonts") format("woff2");
    unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}

@font-face {
    font-family: "Tajawal";
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url("/AEO/javax.faces.resource/Tajawal-Regular-Latin.woff2.xhtml?ln=fonts") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: "Tajawal";
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url("/AEO/javax.faces.resource/Tajawal-Medium-Arabic.woff2.xhtml?ln=fonts") format("woff2");
    unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}

@font-face {
    font-family: "Tajawal";
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url("/AEO/javax.faces.resource/Tajawal-Medium-Latin.woff2.xhtml?ln=fonts") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: "Tajawal";
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url("/AEO/javax.faces.resource/Tajawal-Bold-Arabic.woff2.xhtml?ln=fonts") format("woff2");
    unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}

@font-face {
    font-family: "Tajawal";
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url("/AEO/javax.faces.resource/Tajawal-Bold-Latin.woff2.xhtml?ln=fonts") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: "Tajawal";
    font-style: normal;
    font-weight: 800;
    font-display: swap;
    src: url("/AEO/javax.faces.resource/Tajawal-ExtraBold-Arabic.woff2.xhtml?ln=fonts") format("woff2");
    unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}

@font-face {
    font-family: "Tajawal";
    font-style: normal;
    font-weight: 800;
    font-display: swap;
    src: url("/AEO/javax.faces.resource/Tajawal-ExtraBold-Latin.woff2.xhtml?ln=fonts") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
    --aeo-font-family: "Tajawal", "Segoe UI", Tahoma, Arial, sans-serif;
    --aeo-primary: #075985;
    --aeo-primary-dark: #0c4a6e;
    --aeo-primary-light: #e0f2fe;
    --aeo-accent: #047857;
    --aeo-accent-dark: #065f46;
    --aeo-accent-light: #d1fae5;
    --aeo-surface: #ffffff;
    --aeo-surface-soft: #f8fafc;
    --aeo-surface-muted: #f1f5f9;
    --aeo-border: #cbd5e1;
    --aeo-border-light: #e2e8f0;
    --aeo-text-dark: #0f172a;
    --aeo-text-muted: #64748b;
    --aeo-danger: #ef4444;
    --aeo-danger-dark: #b91c1c;
    --aeo-focus-ring: 0 0 0 3px rgba(7, 89, 133, 0.16);
    --aeo-radius-lg: 16px;
    --aeo-radius-md: 10px;
    --aeo-radius-sm: 8px;
    --aeo-shadow-card: 0 4px 18px -2px rgba(15, 23, 42, 0.06), 0 2px 6px -1px rgba(15, 23, 42, 0.03);
    --aeo-shadow-hover: 0 10px 25px -3px rgba(15, 23, 42, 0.1), 0 4px 8px -2px rgba(15, 23, 42, 0.04);
}

/* ==========================================================================
   1. Base & Flexbox Boundary Resets (PREVENTS GRID OVERFLOWS)
   ========================================================================== */
.aeo-reg-page {
    max-width: 1240px;
    margin: 1.25rem auto 3.5rem auto;
    padding: 0 1.25rem;
    direction: rtl;
    box-sizing: border-box;
    color: var(--aeo-text-dark);
    font-family: var(--aeo-font-family);
    line-height: 1.5;
}

.aeo-reg-page *,
.aeo-reg-page *::before,
.aeo-reg-page *::after {
    box-sizing: border-box;
}

/* Keep the page typography consistent without affecting PrimeIcons or other views. */
.aeo-reg-page .ui-widget:not(.pi),
.aeo-reg-page .ui-widget .ui-widget:not(.pi),
.ui-selectonemenu-panel[id^="frmApplyForRegistration:"] {
    font-family: var(--aeo-font-family) !important;
}

.aeo-reg-page input,
.aeo-reg-page button,
.aeo-reg-page select,
.aeo-reg-page textarea {
    font-family: inherit;
}

/* The page-specific stylesheet is loaded after the template styles. */
.top-page,
.top-page .ui-widget:not(.pi),
.bottom-page,
.bottom-page .ui-widget:not(.pi) {
    font-family: var(--aeo-font-family) !important;
}

/* Flexbox Column Protection - Prevents items from blowing out of column widths */
.aeo-reg-page .p-grid > [class*="p-col"],
.aeo-reg-page .ui-g > [class*="ui-g"] {
    min-width: 0 !important;
    box-sizing: border-box !important;
}

@media (max-width: 768px) {
    .aeo-reg-page {
        margin: 0.75rem auto 2rem auto;
        padding: 0 0.5rem;
    }
}

/* Compact section navigation for this long form. */
.aeo-form-steps {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.65rem;
    margin: 0 0 1.5rem;
    padding: 0.75rem;
    border: 1px solid var(--aeo-border-light);
    border-radius: var(--aeo-radius-lg);
    background: rgba(255, 255, 255, 0.94);
    box-shadow: var(--aeo-shadow-card);
}

.aeo-form-step {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    min-width: 0;
    min-height: 44px;
    padding: 0.55rem 0.7rem;
    border: 1px solid transparent;
    border-radius: var(--aeo-radius-md);
    color: var(--aeo-text-muted);
    font-size: 0.86rem;
    font-weight: 700;
    text-align: center;
    text-decoration: none;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.aeo-form-step:hover,
.aeo-form-step:focus-visible {
    border-color: #bae6fd;
    background: var(--aeo-primary-light);
    color: var(--aeo-primary-dark);
    outline: none;
}

.aeo-step-index {
    display: inline-flex;
    flex: 0 0 1.8rem;
    align-items: center;
    justify-content: center;
    width: 1.8rem;
    height: 1.8rem;
    border-radius: 50%;
    background: var(--aeo-primary);
    color: #ffffff;
    font-size: 0.8rem;
    font-variant-numeric: tabular-nums;
}

@media (max-width: 768px) {
    .aeo-form-steps {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.45rem;
        margin-bottom: 1rem;
        padding: 0.55rem;
    }

    .aeo-form-step {
        justify-content: flex-start;
        padding-inline: 0.6rem;
    }
}

/* ==========================================================================
   2. Hero Header Banner
   ========================================================================== */
.aeo-hero-banner {
    background: linear-gradient(135deg, #075985 0%, #0369a1 50%, #047857 100%);
    color: #ffffff;
    padding: 1.6rem 2rem;
    border-radius: var(--aeo-radius-lg);
    margin-bottom: 1.5rem;
    box-shadow: 0 12px 28px rgba(7, 89, 133, 0.2);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.25rem;
}

.aeo-hero-content {
    position: relative;
    z-index: 1;
    flex: 1 1 auto;
    min-width: 0;
}

.aeo-hero-title {
    font-size: 1.5rem;
    font-weight: 800;
    margin: 0 0 0.35rem 0;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    line-height: 1.3;
    min-width: 0;
    overflow-wrap: anywhere;
}

.aeo-hero-title > .pi {
    flex: 0 0 auto;
}

.aeo-hero-title > span {
    min-width: 0;
    overflow-wrap: anywhere;
}

.aeo-hero-subtitle {
    font-size: 0.92rem;
    margin: 0;
    opacity: 0.94;
    line-height: 1.6;
    color: #f1f5f9;
    overflow-wrap: anywhere;
}

.aeo-hero-badge {
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.35);
    padding: 0.55rem 1.15rem;
    border-radius: 30px;
    font-size: 0.85rem;
    font-weight: 700;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
    flex-shrink: 0;
    min-width: 0;
    max-width: 100%;
}

@media (max-width: 768px) {
    .aeo-hero-banner {
        flex-direction: column;
        align-items: flex-start;
        padding: 1.25rem;
        gap: 0.85rem;
    }
    .aeo-hero-title {
        font-size: 1.2rem;
        align-items: flex-start;
        flex-wrap: wrap;
    }
    .aeo-hero-subtitle {
        font-size: 0.85rem;
    }
    .aeo-hero-badge {
        align-self: stretch;
        justify-content: center;
        white-space: normal;
        text-align: center;
        overflow-wrap: anywhere;
    }
}

/* ==========================================================================
   3. Elevation Cards
   ========================================================================== */
.aeo-section-card {
    background: var(--aeo-surface);
    border-radius: var(--aeo-radius-lg);
    border: 1px solid var(--aeo-border-light);
    box-shadow: var(--aeo-shadow-card);
    margin-bottom: 1.5rem;
    overflow: hidden;
    transition: box-shadow 0.25s ease, border-color 0.25s ease;
}

.aeo-section-card:hover {
    box-shadow: var(--aeo-shadow-hover);
    border-color: #cbd5e1;
}

.aeo-card-header {
    background: linear-gradient(90deg, #f8fafc 0%, #f1f5f9 100%);
    padding: 0.95rem 1.4rem;
    border-bottom: 1px solid var(--aeo-border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.aeo-card-header-left {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    min-width: 0;
}

.aeo-card-header-left > div:last-child {
    min-width: 0;
}

.aeo-card-icon {
    width: 38px;
    height: 38px;
    border-radius: var(--aeo-radius-md);
    background: var(--aeo-primary-light);
    color: var(--aeo-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.aeo-card-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--aeo-text-dark);
    overflow-wrap: anywhere;
}

.aeo-card-desc {
    margin: 0.15rem 0 0 0;
    font-size: 0.82rem;
    color: var(--aeo-text-muted);
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.aeo-card-body {
    padding: 1.35rem 1.4rem;
}

@media (max-width: 768px) {
    .aeo-card-header {
        padding: 0.85rem 1rem;
    }
    .aeo-card-body {
        padding: 1rem 0.85rem;
    }
}

/* ==========================================================================
   4. Form Field Containers & Label System
   ========================================================================== */
.aeo-field {
    margin-bottom: 1.1rem;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.aeo-field-label {
    font-weight: 700 !important;
    font-size: 0.88rem !important;
    color: #1e293b !important;
    margin-bottom: 0.4rem !important;
    display: block;
    text-align: right;
    line-height: 1.4;
    min-width: 0;
    white-space: normal;
    overflow: visible;
    overflow-wrap: anywhere;
    word-break: normal;
}

/* PrimeFaces renders this indicator for required controls; do not add a second star. */
.aeo-reg-page .ui-outputlabel-rfi {
    display: inline-block;
    margin: 0 0.22rem;
    color: var(--aeo-danger-dark) !important;
    font-size: 0.95em;
    font-weight: 800;
    line-height: 1;
}

/* Reusable direction helper for email, phone, identifiers and mixed numeric codes. */
.aeo-reg-page .aeo-ltr,
.aeo-reg-page .aeo-ltr.ui-inputfield,
.aeo-reg-page .aeo-ltr .ui-inputfield {
    direction: ltr !important;
    unicode-bidi: isolate;
    text-align: left !important;
}

.aeo-reg-page input[id$="itxtPhoneNo"],
.aeo-reg-page input[id$="itxtRepresentativePhoneNo"],
.aeo-reg-page input[id$="itxtAuthorizedRepresentativeNid"],
.aeo-reg-page input[id$="itxtEmail"],
.aeo-reg-page input[id$="itxtPreviousCode"] {
    direction: ltr !important;
    unicode-bidi: isolate;
    text-align: left !important;
    font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   5. Standard Text Inputs
   ========================================================================== */
.aeo-reg-page .ui-inputtext {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    border-radius: var(--aeo-radius-sm) !important;
    border: 1px solid var(--aeo-border) !important;
    background: #ffffff !important;
    padding: 0.55rem 0.85rem !important;
    font-size: 0.92rem !important;
    color: var(--aeo-text-dark) !important;
    transition: all 0.2s ease !important;
    box-sizing: border-box !important;
    min-height: 42px !important;
    height: 42px !important;
}

.aeo-reg-page .ui-inputtext:hover {
    border-color: #94a3b8 !important;
}

.aeo-reg-page .ui-inputtext:focus,
.aeo-reg-page .ui-inputtext.ui-state-focus {
    border-color: var(--aeo-primary) !important;
    box-shadow: var(--aeo-focus-ring) !important;
    outline: none !important;
}

/* ==========================================================================
   6. Dropdowns (p:selectOneMenu) - STRICT OVERLAP PROTECTION
   ========================================================================== */
.aeo-reg-page .ui-selectonemenu {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    border-radius: var(--aeo-radius-sm) !important;
    border: 1px solid var(--aeo-border) !important;
    background: #ffffff !important;
    padding: 0 !important;
    min-height: 42px !important;
    height: 42px !important;
    display: flex !important;
    align-items: center !important;
    position: relative !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
    transition: all 0.2s ease !important;
}

.aeo-reg-page .ui-selectonemenu:hover {
    border-color: #94a3b8 !important;
}

.aeo-reg-page .ui-selectonemenu.ui-state-focus,
.aeo-reg-page .ui-selectonemenu:focus {
    border-color: var(--aeo-primary) !important;
    box-shadow: var(--aeo-focus-ring) !important;
    outline: none !important;
}

/* SelectOneMenu Internal Label in RTL */
.aeo-reg-page .ui-selectonemenu .ui-selectonemenu-label {
    padding: 0.55rem 0.85rem !important;
    padding-left: 2.6rem !important; /* Space for the trigger arrow on the left in RTL */
    padding-right: 0.85rem !important;
    font-size: 0.92rem !important;
    color: var(--aeo-text-dark) !important;
    line-height: 1.5 !important;
    text-align: right !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    border: none !important;
}

/* SelectOneMenu Trigger Arrow in RTL */
.aeo-reg-page .ui-selectonemenu .ui-selectonemenu-trigger {
    position: absolute !important;
    top: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    right: auto !important;
    width: 2.4rem !important;
    height: 100% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border: none !important;
    background: transparent !important;
    padding: 0 !important;
}

.aeo-reg-page .ui-selectonemenu .ui-selectonemenu-trigger .ui-icon {
    margin-top: 0 !important;
    color: #64748b !important;
}

/* Dropdown Popup Items List */
.ui-selectonemenu-panel {
    max-width: 95vw !important;
    box-sizing: border-box !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.14) !important;
    border-radius: var(--aeo-radius-sm) !important;
    border: 1px solid var(--aeo-border) !important;
    z-index: 100000 !important;
}

.ui-selectonemenu-panel .ui-selectonemenu-items {
    padding: 0.35rem 0 !important;
}

.ui-selectonemenu-panel .ui-selectonemenu-item {
    white-space: normal !important;
    word-break: break-word !important;
    line-height: 1.5 !important;
    padding: 0.6rem 0.9rem !important;
    text-align: right !important;
    font-size: 0.9rem !important;
    border-radius: 4px !important;
    margin: 2px 4px !important;
}

.ui-selectonemenu-panel .ui-selectonemenu-item.ui-state-highlight {
    background: var(--aeo-primary) !important;
    color: #ffffff !important;
}

/* Detail Textarea (Field Details & Category Details) */
.aeo-detail-textarea {
    width: 100% !important;
    max-width: 100% !important;
    min-height: 56px !important;
    border-radius: var(--aeo-radius-sm) !important;
    border: 1px solid var(--aeo-border) !important;
    background: #f8fafc !important;
    color: #334155 !important;
    font-size: 0.9rem !important;
    line-height: 1.6 !important;
    padding: 0.6rem 0.85rem !important;
    box-sizing: border-box !important;
    white-space: normal !important;
    word-break: break-word !important;
    resize: vertical !important;
}

/* ========================================================================== 
   Component States: validation, focus and disabled controls
   ========================================================================== */
.aeo-reg-page .ui-inputtext.ui-state-error,
.aeo-reg-page .ui-inputfield.ui-state-error,
.aeo-reg-page .ui-selectonemenu.ui-state-error {
    border-color: var(--aeo-danger-dark) !important;
    background-color: #fffafa !important;
}

.aeo-reg-page .ui-inputtext.ui-state-error:focus,
.aeo-reg-page .ui-inputtext.ui-state-error.ui-state-focus,
.aeo-reg-page .ui-selectonemenu.ui-state-error.ui-state-focus,
.aeo-reg-page .ui-selectonemenu.ui-state-error:focus {
    border-color: var(--aeo-danger-dark) !important;
    box-shadow: 0 0 0 3px rgba(185, 28, 28, 0.15) !important;
    outline: none !important;
}

.aeo-reg-page .ui-inputtext:disabled,
.aeo-reg-page .ui-inputtext.ui-state-disabled,
.aeo-reg-page .ui-selectonemenu.ui-state-disabled {
    border-color: var(--aeo-border-light) !important;
    background: var(--aeo-surface-muted) !important;
    color: var(--aeo-text-muted) !important;
    box-shadow: none !important;
    cursor: not-allowed !important;
    opacity: 1 !important;
}

.aeo-reg-page .ui-selectonemenu.ui-state-disabled .ui-selectonemenu-label,
.aeo-reg-page .ui-selectonemenu.ui-state-disabled .ui-selectonemenu-trigger {
    color: var(--aeo-text-muted) !important;
    cursor: not-allowed !important;
}

.aeo-reg-page .ui-button.ui-state-disabled,
.aeo-reg-page .ui-fileupload-choose.ui-state-disabled,
.aeo-reg-page .ui-button:disabled {
    opacity: 0.55 !important;
    filter: saturate(0.45);
    box-shadow: none !important;
    cursor: not-allowed !important;
    transform: none !important;
}

.aeo-reg-page .ui-message {
    align-self: flex-start;
    max-width: 100%;
    margin-top: 0.35rem;
    overflow-wrap: anywhere;
}

.aeo-reg-page .ui-message-error {
    border: 1px solid #fecaca !important;
    border-radius: 7px;
    background: #fef2f2 !important;
    color: var(--aeo-danger-dark) !important;
    font-size: 0.82rem;
    line-height: 1.45;
    padding: 0.4rem 0.55rem;
}

.aeo-reg-page .ui-message-error-icon,
.aeo-reg-page .ui-message-error-detail,
.aeo-reg-page .ui-message-error-summary {
    color: inherit !important;
}

.aeo-field-help,
.aeo-table-hint {
    margin: 0;
    color: var(--aeo-text-muted);
    font-size: 0.8rem;
    line-height: 1.6;
    overflow-wrap: anywhere;
}

.aeo-field-help {
    max-width: 34rem;
    text-align: center;
}

/* Email ownership verification ------------------------------------------------ */
.aeo-email-label-row {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 0.45rem 0.7rem;
    margin-bottom: 0.4rem;
}

.aeo-email-label-row .aeo-field-label {
    margin-bottom: 0 !important;
}

.aeo-email-status {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    min-height: 1.75rem;
    padding: 0.2rem 0.65rem;
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 800;
    line-height: 1.2;
}

.aeo-email-status-verified {
    color: #047857;
    background: #ecfdf5;
    border-color: #a7f3d0;
}

.aeo-email-status-pending {
    color: #9a5b05;
    background: #fffbeb;
    border-color: #fde68a;
}

.aeo-email-entry-row,
.aeo-email-otp-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: stretch;
    gap: 0.65rem;
    width: 100%;
    min-width: 0;
}

.aeo-email-entry-row > .ui-inputfield,
.aeo-email-otp-row > .ui-inputfield {
    width: 100% !important;
    min-width: 0 !important;
}

.aeo-email-send-btn.ui-button,
.aeo-email-verify-btn.ui-button {
    min-width: 10.5rem;
    min-height: 2.75rem;
    margin: 0 !important;
    border-radius: 9px !important;
    font-family: var(--aeo-font) !important;
    font-weight: 800 !important;
    white-space: nowrap;
}

.aeo-email-send-btn.ui-button {
    color: #075985 !important;
    background: #f0f9ff !important;
    border: 1px solid #7dd3fc !important;
}

.aeo-email-send-btn.ui-button:hover,
.aeo-email-send-btn.ui-button:focus {
    color: #ffffff !important;
    background: #03698a !important;
    border-color: #03698a !important;
}

.aeo-email-verification-box {
    margin-top: 0.7rem;
    padding: 0.9rem;
    background: linear-gradient(135deg, #f8fafc 0%, #f0f9ff 100%);
    border: 1px solid #bae6fd;
    border-radius: 11px;
}

.aeo-email-verification-copy,
.aeo-email-status-hint,
.aeo-email-verified-note {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.8rem;
    line-height: 1.6;
}

.aeo-email-verification-copy {
    margin-bottom: 0.7rem;
    color: #334155;
    font-weight: 650;
}

.aeo-email-otp-input {
    text-align: center !important;
    direction: ltr !important;
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace !important;
    font-size: 1.05rem !important;
    font-weight: 800 !important;
    letter-spacing: 0.35rem;
    font-variant-numeric: tabular-nums;
}

.aeo-email-verify-btn.ui-button {
    color: #ffffff !important;
    background: #047857 !important;
    border: 1px solid #047857 !important;
}

.aeo-email-verify-btn.ui-button:hover,
.aeo-email-verify-btn.ui-button:focus {
    background: #065f46 !important;
    border-color: #065f46 !important;
}

.aeo-email-verification-box small {
    display: block;
    margin-top: 0.55rem;
    color: #64748b;
    font-size: 0.74rem;
}

.aeo-email-status-hint {
    margin-top: 0.55rem;
    color: #64748b;
}

.aeo-email-verified-note {
    margin-top: 0.6rem;
    padding: 0.6rem 0.75rem;
    color: #047857;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 9px;
    font-weight: 700;
}

.aeo-email-bypass-note {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    margin-top: 0.6rem;
    padding: 0.7rem 0.8rem;
    color: #92400e;
    background: #fffbeb;
    border: 1px solid #fcd34d;
    border-radius: 9px;
    font-size: 0.8rem;
    font-weight: 750;
    line-height: 1.65;
}

.aeo-email-bypass-note .pi {
    margin-top: 0.2rem;
    color: #d97706;
}

@media (max-width: 620px) {
    .aeo-email-entry-row,
    .aeo-email-otp-row {
        grid-template-columns: minmax(0, 1fr);
    }

    .aeo-email-send-btn.ui-button,
    .aeo-email-verify-btn.ui-button {
        width: 100% !important;
        min-width: 0;
    }
}

.aeo-photo-grid-cell {
    margin-top: 0.5rem;
}

.aeo-document-name {
    color: var(--aeo-text-dark);
    font-weight: 700;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.aeo-payment-logos {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.25rem;
    margin: 0 0 1.5rem;
    padding: 1rem 1.25rem;
    border: 1px solid var(--aeo-border-light);
    border-radius: var(--aeo-radius-lg);
    background: var(--aeo-surface);
    box-shadow: var(--aeo-shadow-card);
}

.aeo-payment-logo {
    display: block;
    width: auto;
    max-width: 180px;
    height: 64px;
    object-fit: contain;
}

.aeo-payment-logo-customs {
    width: 70px;
}

.aeo-payment-link-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--aeo-primary-light);
    color: var(--aeo-primary);
    font-size: 1.15rem;
}

.aeo-sadad-page .ui-inputnumber,
.aeo-sadad-page .ui-inputnumber-input {
    width: 100% !important;
    max-width: 100% !important;
}

.aeo-representative-row-tools {
    display: grid;
    grid-template-columns: 78px minmax(0, 1fr);
    align-items: center;
    gap: 0.75rem;
    width: 100%;
}

.aeo-representative-photo-frame {
    width: 72px;
    height: 88px;
    overflow: hidden;
    border: 3px solid #ffffff;
    border-radius: var(--aeo-radius-md);
    background: var(--aeo-surface-muted);
    box-shadow: 0 3px 10px rgba(15, 23, 42, 0.14);
}

.aeo-representative-photo {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.aeo-representative-row-actions.aeo-table-actions {
    grid-template-columns: minmax(125px, 1fr) minmax(88px, 0.75fr);
}

.aeo-table-hint {
    display: flex;
    align-items: flex-start;
    gap: 0.45rem;
    margin-bottom: 0.75rem;
    padding: 0.6rem 0.75rem;
    border: 1px solid #bae6fd;
    border-radius: var(--aeo-radius-sm);
    background: #f0f9ff;
    color: var(--aeo-primary-dark);
}

.aeo-table-hint .pi {
    flex: 0 0 auto;
    margin-top: 0.22rem;
}

/* ==========================================================================
   7. Representative Photo Widget
   ========================================================================== */
.aeo-photo-widget {
    background: var(--aeo-surface-soft);
    border: 2px dashed var(--aeo-border);
    border-radius: var(--aeo-radius-md);
    padding: 1.2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.85rem;
    text-align: center;
    box-sizing: border-box;
    width: 100%;
}

.aeo-photo-preview-box {
    width: 120px;
    height: 150px;
    border-radius: var(--aeo-radius-md);
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    background: #e2e8f0;
    border: 3px solid #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
}

.aeo-photo-preview-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.aeo-photo-preview-content,
.aeo-photo-placeholder {
    width: 100%;
    height: 100%;
}

.aeo-photo-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0.75rem;
    color: var(--aeo-text-muted);
    font-size: 0.78rem;
    line-height: 1.4;
}

.aeo-photo-placeholder .pi {
    color: #94a3b8;
    font-size: 2rem;
}

.aeo-photo-controls {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
    max-width: 220px;
}

.aeo-photo-controls .ui-fileupload-buttonbar {
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
}

.aeo-photo-controls .ui-fileupload-choose {
    width: 100% !important;
    border-radius: var(--aeo-radius-sm) !important;
    background: var(--aeo-primary) !important;
    border: none !important;
    font-size: 0.88rem !important;
    padding: 0.45rem 0.85rem !important;
    box-sizing: border-box !important;
}

.aeo-photo-controls .ui-fileupload-choose .ui-button-text,
.aeo-table-actions .ui-fileupload-choose .ui-button-text {
    display: inline-block !important;
}

/* Keep the browser's native file picker control visually hidden inside PF8. */
.aeo-reg-page .ui-fileupload-choose input[type="file"] {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    margin: 0 !important;
    opacity: 0 !important;
    color: transparent !important;
    font-size: 0 !important;
}

.aeo-reg-page .ui-fileupload-choose input[type="file"]::file-selector-button,
.aeo-reg-page .ui-fileupload-choose input[type="file"]::-webkit-file-upload-button {
    width: 100% !important;
    height: 100% !important;
    border: 0 !important;
    opacity: 0 !important;
}

.aeo-btn-clear-photo {
    width: 100% !important;
    border-radius: var(--aeo-radius-sm) !important;
    background: #ffffff !important;
    color: var(--aeo-danger-dark) !important;
    border: 1px solid #fca5a5 !important;
    font-size: 0.85rem !important;
    padding: 0.4rem !important;
    box-sizing: border-box !important;
}

.aeo-btn-clear-photo:hover {
    background: #fef2f2 !important;
}

/* ==========================================================================
   8. Required Documents Table - COMPREHENSIVE OVERLAP PREVENTION
   ========================================================================== */
.aeo-table-scroll-wrapper {
    width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-inline: contain;
    scrollbar-color: #94a3b8 #f1f5f9;
    scrollbar-width: thin;
    border-radius: var(--aeo-radius-md);
    border: 1px solid var(--aeo-border-light);
    background: #ffffff;
    box-sizing: border-box;
    margin-top: 0.25rem;
    position: relative;
}

.aeo-table-scroll-wrapper:focus-visible {
    outline: 3px solid rgba(7, 89, 133, 0.2);
    outline-offset: 2px;
}

.aeo-table-scroll-wrapper::-webkit-scrollbar {
    height: 10px;
}

.aeo-table-scroll-wrapper::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 999px;
}

.aeo-table-scroll-wrapper::-webkit-scrollbar-thumb {
    background: #94a3b8;
    border: 2px solid #f1f5f9;
    border-radius: 999px;
}

.aeo-table-scroll-wrapper::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

.aeo-doc-table {
    min-width: 1080px !important;
    width: 100% !important;
    border-collapse: collapse !important;
    border: none !important;
}

.aeo-doc-table .ui-datatable-header,
.aeo-doc-table thead th {
    background: #f8fafc !important;
    color: var(--aeo-text-dark) !important;
    font-weight: 700 !important;
    border: 1px solid var(--aeo-border-light) !important;
    padding: 0.85rem 0.6rem !important;
    font-size: 0.88rem !important;
    text-align: center !important;
    white-space: nowrap !important;
}

.aeo-doc-table tbody td {
    border: 1px solid #f1f5f9 !important;
    padding: 0.7rem 0.5rem !important;
    font-size: 0.88rem !important;
    vertical-align: middle !important;
    text-align: center !important;
    overflow-wrap: anywhere;
}

.aeo-doc-table tbody tr:hover {
    background: #f8fafc !important;
}

/* Cell editor input width */
.aeo-doc-table .ui-cell-editor-input input {
    width: 100% !important;
    min-height: 36px !important;
    height: 36px !important;
    padding: 0.35rem 0.6rem !important;
    font-size: 0.88rem !important;
    border-radius: 6px !important;
    box-sizing: border-box !important;
}

.aeo-badge-pages {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    background: var(--aeo-primary-light);
    color: var(--aeo-primary);
    font-weight: 700;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.85rem;
    white-space: nowrap;
}

.aeo-badge-pages.empty {
    background: #fee2e2;
    color: #b91c1c;
}

/* PF8 rowEditor: explicit, high-contrast actions for edit/save/cancel. */
.aeo-doc-table .aeo-edit-column {
    width: 164px !important;
    min-width: 164px !important;
    text-align: center !important;
}

.aeo-doc-table .ui-row-editor {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    flex-wrap: nowrap;
    gap: 7px;
    min-width: 92px;
    white-space: nowrap;
}

.aeo-doc-table .ui-row-editor > a {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0.38rem;
    flex: 0 0 auto;
    min-width: 68px;
    height: 38px;
    margin: 0 !important;
    padding: 0 0.68rem;
    border: 1px solid transparent !important;
    border-radius: 8px;
    color: #ffffff !important;
    box-shadow: 0 3px 8px rgba(15, 23, 42, 0.14);
    cursor: pointer;
    line-height: 1;
    text-decoration: none !important;
    text-shadow: none !important;
    transition: background-color 0.16s ease, border-color 0.16s ease,
                box-shadow 0.16s ease, transform 0.16s ease;
}

/* Replace the legacy theme sprite with PrimeIcons so the icon never disappears. */
.aeo-doc-table .ui-row-editor > a > .ui-icon {
    display: none !important;
}

.aeo-doc-table .ui-row-editor > a::before {
    flex: 0 0 auto;
    color: currentColor;
    font-family: Arial, sans-serif !important;
    font-size: 0.95rem;
    font-style: normal;
    font-variant: normal;
    font-weight: 800;
    line-height: 1;
    text-transform: none;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.aeo-doc-table .ui-row-editor > a::after {
    color: currentColor;
    font-family: "Tajawal", "Noto Sans Arabic", Arial, sans-serif;
    font-size: 0.76rem;
    font-weight: 800;
    line-height: 1;
}

.aeo-doc-table .ui-row-editor .ui-row-editor-pencil {
    display: inline-flex !important;
    min-width: 92px;
    background: #075985 !important;
    border-color: #075985 !important;
}

.aeo-doc-table .ui-row-editor .ui-row-editor-pencil::before {
    content: "\270E";
}

.aeo-doc-table .ui-row-editor .ui-row-editor-pencil::after {
    content: "\062A\0639\062F\064A\0644";
}

.aeo-doc-table .ui-row-editor .ui-row-editor-pencil:hover {
    background: #064b70 !important;
    border-color: #064b70 !important;
}

.aeo-doc-table .ui-row-editor .ui-row-editor-check {
    background: #08775f !important;
    border-color: #08775f !important;
}

.aeo-doc-table .ui-row-editor .ui-row-editor-check::before {
    content: "\2713";
}

.aeo-doc-table .ui-row-editor .ui-row-editor-check::after {
    content: "\062D\0641\0638";
}

.aeo-doc-table .ui-row-editor .ui-row-editor-check:hover {
    background: #06634f !important;
    border-color: #06634f !important;
}

.aeo-doc-table .ui-row-editor .ui-row-editor-close {
    background: #b4232c !important;
    border-color: #b4232c !important;
}

.aeo-doc-table .ui-row-editor .ui-row-editor-close::before {
    content: "\00D7";
}

.aeo-doc-table .ui-row-editor .ui-row-editor-close::after {
    content: "\0625\0644\063A\0627\0621";
}

.aeo-doc-table .ui-row-editor .ui-row-editor-close:hover {
    background: #941c24 !important;
    border-color: #941c24 !important;
}

.aeo-doc-table .ui-row-editor > a:hover {
    color: #ffffff !important;
    box-shadow: 0 5px 12px rgba(15, 23, 42, 0.2);
    transform: translateY(-1px);
}

.aeo-doc-table .ui-row-editor > a:active {
    box-shadow: 0 2px 5px rgba(15, 23, 42, 0.16);
    transform: translateY(0);
}

.aeo-doc-table .ui-row-editor > a:focus {
    outline: 3px solid rgba(7, 89, 133, 0.24) !important;
    outline-offset: 2px !important;
}

.aeo-doc-table .ui-row-editor .ui-row-editor-check,
.aeo-doc-table .ui-row-editor .ui-row-editor-close {
    display: none !important;
}

.aeo-doc-table .ui-row-editing .ui-row-editor .ui-row-editor-pencil {
    display: none !important;
}

.aeo-doc-table .ui-row-editing .ui-row-editor .ui-row-editor-check,
.aeo-doc-table .ui-row-editing .ui-row-editor .ui-row-editor-close {
    display: inline-flex !important;
}

.aeo-doc-table .ui-row-editing .ui-row-editor {
    min-width: 143px;
}

/* Action buttons inside Table - HIGH SPECIFICITY TO OVERRIDE ALL CSS */
.aeo-doc-table .aeo-actions-column {
    width: 350px !important;
    min-width: 350px !important;
    text-align: center !important;
}

.aeo-table-actions {
    display: grid !important;
    grid-template-columns: minmax(126px, 1.35fr) minmax(100px, 1fr) minmax(82px, 0.85fr);
    align-items: center !important;
    justify-content: stretch !important;
    gap: 8px !important;
    width: 100% !important;
    min-width: 0 !important;
    white-space: normal !important;
}

.aeo-document-file-warning {
    grid-column: 1 / -1;
    display: flex;
    align-items: flex-start;
    gap: 0.45rem;
    width: 100%;
    padding: 0.55rem 0.65rem;
    border: 1px solid #fdba74;
    border-radius: var(--aeo-radius-sm);
    background: #fff7ed;
    color: #9a3412;
    font-size: 0.76rem;
    font-weight: 700;
    line-height: 1.55;
    text-align: right;
    box-sizing: border-box;
}

.aeo-document-file-warning .pi {
    flex: 0 0 auto;
    margin-top: 0.18rem;
    color: #ea580c;
}

.aeo-table-actions .ui-fileupload {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
}

.aeo-table-actions .ui-fileupload-buttonbar {
    display: block !important;
    width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
    background: transparent !important;
    border: none !important;
}

.aeo-table-actions .ui-fileupload-choose {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: var(--aeo-radius-sm) !important;
    background: #0369a1 !important;
    border: none !important;
    height: 34px !important;
    padding: 0 0.75rem !important;
    font-size: 0.82rem !important;
    white-space: nowrap !important;
    margin: 0 !important;
    width: 100% !important;
    min-width: 0 !important;
    overflow: hidden !important;
}

.aeo-table-actions .ui-fileupload-choose,
.aeo-table-actions .ui-button {
    position: relative !important;
    gap: 0.4rem;
}

.aeo-table-actions .ui-button-icon-left,
.aeo-table-actions .ui-button-icon-right {
    position: static !important;
    flex: 0 0 auto;
    margin: 0 !important;
}

.aeo-table-actions .ui-button-text-icon-left .ui-button-text,
.aeo-table-actions .ui-button-text-icon-right .ui-button-text,
.aeo-table-actions .ui-button-text {
    display: inline-block !important;
    padding: 0 !important;
    line-height: 1.2 !important;
    white-space: nowrap !important;
}

.aeo-table-actions .ui-fileupload-choose:hover {
    background: #075985 !important;
}

.aeo-btn-view-doc {
    background: #0f766e !important;
    border: none !important;
    color: #ffffff !important;
    border-radius: var(--aeo-radius-sm) !important;
    height: 34px !important;
    padding: 0 0.75rem !important;
    font-size: 0.82rem !important;
    white-space: nowrap !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin: 0 !important;
    width: 100% !important;
    min-width: 0 !important;
    overflow: hidden !important;
}

.aeo-btn-view-doc:hover {
    background: #115e59 !important;
}

.aeo-btn-clear-doc {
    background: #f1f5f9 !important;
    border: 1px solid #cbd5e1 !important;
    color: #475569 !important;
    border-radius: var(--aeo-radius-sm) !important;
    height: 34px !important;
    padding: 0 0.75rem !important;
    font-size: 0.82rem !important;
    white-space: nowrap !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin: 0 !important;
    width: 100% !important;
    min-width: 0 !important;
    overflow: hidden !important;
}

.aeo-btn-clear-doc:hover {
    background: #fee2e2 !important;
    color: #b91c1c !important;
    border-color: #fca5a5 !important;
}

/* ==========================================================================
   9. Action Bar & Submit
   ========================================================================== */
.aeo-action-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--aeo-surface);
    border-radius: var(--aeo-radius-lg);
    border: 1px solid var(--aeo-border-light);
    box-shadow: var(--aeo-shadow-card);
    padding: 1.25rem 1.75rem;
    margin-top: 1.75rem;
    gap: 1rem;
    box-sizing: border-box;
}

.aeo-action-primary-group {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.aeo-btn-secondary {
    min-height: 44px !important;
    padding: 0.7rem 1.45rem !important;
    border: 1px solid #7dd3fc !important;
    border-radius: var(--aeo-radius-md) !important;
    background: #f0f9ff !important;
    color: var(--aeo-primary-dark) !important;
    font-size: 0.95rem !important;
    font-weight: 700 !important;
    box-shadow: none !important;
}

.aeo-btn-secondary:hover {
    border-color: #38bdf8 !important;
    background: #e0f2fe !important;
    color: var(--aeo-primary-dark) !important;
}

.aeo-btn-submit {
    background: linear-gradient(135deg, #047857 0%, #065f46 100%) !important;
    border: none !important;
    color: #ffffff !important;
    font-size: 1.05rem !important;
    font-weight: 700 !important;
    padding: 0.75rem 2.5rem !important;
    border-radius: var(--aeo-radius-md) !important;
    box-shadow: 0 6px 18px rgba(4, 120, 87, 0.28) !important;
    cursor: pointer;
    transition: all 0.2s ease !important;
    min-height: 44px;
}

.aeo-btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(4, 120, 87, 0.38) !important;
}

.aeo-btn-back {
    background: transparent !important;
    color: var(--aeo-text-muted) !important;
    border: 1px solid var(--aeo-border) !important;
    border-radius: var(--aeo-radius-md) !important;
    font-weight: 600 !important;
    font-size: 0.92rem !important;
    padding: 0.65rem 1.5rem !important;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
    min-height: 44px;
    box-sizing: border-box;
}

.aeo-btn-back:hover {
    background: var(--aeo-surface-muted) !important;
    color: var(--aeo-text-dark) !important;
    border-color: #cbd5e1 !important;
}

.aeo-reg-page .ui-button:focus,
.aeo-reg-page .ui-fileupload-choose:focus,
.aeo-reg-page .ui-row-editor > a:focus,
.aeo-reg-page .aeo-btn-back:focus {
    outline: 3px solid rgba(7, 89, 133, 0.24) !important;
    outline-offset: 2px !important;
}

/* ========================================================================== 
   10. Registration Gallery Dialog
   The dialog may be moved below <body>, so it is scoped through the form id.
   ========================================================================== */
.ui-dialog[id^="frmApplyForRegistration:"] {
    width: min(880px, 94vw) !important;
    max-width: 94vw !important;
    box-sizing: border-box !important;
    font-family: var(--aeo-font-family) !important;
}

.ui-dialog[id^="frmApplyForRegistration:"] .ui-dialog-content {
    width: 100% !important;
    max-width: 100% !important;
    max-height: 82vh !important;
    overflow: auto !important;
    box-sizing: border-box !important;
}

.ui-dialog[id^="frmApplyForRegistration:"] .ui-scrollpanel,
.ui-dialog[id^="frmApplyForRegistration:"] .ui-scrollpanel-native {
    width: 100% !important;
    max-width: 100% !important;
    max-height: 72vh !important;
    box-sizing: border-box !important;
}

.ui-dialog[id^="frmApplyForRegistration:"] .ui-galleria,
.ui-galleria[id$=":gallery"] {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

.ui-dialog[id^="frmApplyForRegistration:"] .ui-galleria-panel-wrapper,
.ui-galleria[id$=":gallery"] .ui-galleria-panel-wrapper {
    width: 100% !important;
    max-width: 100% !important;
    height: min(550px, 62vh) !important;
    max-height: 62vh !important;
    box-sizing: border-box !important;
}

.ui-dialog[id^="frmApplyForRegistration:"] .ui-galleria-panel,
.ui-galleria[id$=":gallery"] .ui-galleria-panel {
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    box-sizing: border-box !important;
}

.ui-dialog[id^="frmApplyForRegistration:"] .ui-galleria-panel img,
.ui-galleria[id$=":gallery"] .ui-galleria-panel img {
    display: block;
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    max-height: 100% !important;
    margin: 0 auto;
    object-fit: contain !important;
}

.ui-dialog[id^="frmApplyForRegistration:"] .ui-galleria-filmstrip-wrapper,
.ui-dialog[id^="frmApplyForRegistration:"] .ui-galleria-caption,
.ui-galleria[id$=":gallery"] .ui-galleria-filmstrip-wrapper,
.ui-galleria[id$=":gallery"] .ui-galleria-caption {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

/* Balanced density between the desktop and stacked mobile layouts. */
@media (min-width: 769px) and (max-width: 1024px) {
    .aeo-reg-page {
        margin-top: 1rem;
        padding-inline: 0.9rem;
    }

    .aeo-hero-banner {
        gap: 1rem;
        padding: 1.35rem 1.5rem;
    }

    .aeo-section-card {
        margin-bottom: 1.2rem;
    }

    .aeo-card-header {
        padding: 0.9rem 1.1rem;
    }

    .aeo-card-body {
        padding: 1.1rem;
    }

    .aeo-field {
        margin-bottom: 0.95rem;
    }

    .aeo-action-bar {
        margin-top: 1.35rem;
        padding: 1.1rem 1.35rem;
    }
}

@media (max-width: 768px) {
    .aeo-action-bar {
        flex-direction: column;
        align-items: stretch;
        padding: 1.25rem 1rem;
        gap: 0.85rem;
    }
    .aeo-btn-submit,
    .aeo-btn-back {
        width: 100% !important;
        justify-content: center;
        text-align: center;
    }

    .aeo-action-primary-group {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }

    .aeo-action-primary-group .aeo-btn-submit,
    .aeo-action-primary-group .aeo-btn-secondary {
        width: 100% !important;
        justify-content: center;
    }

    .aeo-payment-logos {
        gap: 0.75rem;
        padding: 0.85rem;
    }

    .aeo-payment-logo {
        max-width: 130px;
        height: 52px;
    }

    .aeo-reg-page .ui-inputtext,
    .aeo-reg-page .ui-selectonemenu {
        min-height: 44px !important;
        height: 44px !important;
    }

    .aeo-reg-page .ui-selectonemenu .ui-selectonemenu-label {
        padding-left: 3rem !important;
    }

    .aeo-reg-page .ui-selectonemenu .ui-selectonemenu-trigger {
        width: 2.75rem !important;
    }

    .aeo-card-header-left {
        align-items: flex-start;
    }

    .aeo-photo-widget {
        padding: 1rem;
    }

    .aeo-photo-controls .ui-fileupload-choose,
    .aeo-btn-clear-photo {
        min-height: 44px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    .aeo-table-actions {
        display: grid !important;
        grid-template-columns: minmax(126px, 1.35fr) minmax(100px, 1fr) minmax(82px, 0.85fr);
        width: 100% !important;
        min-width: 0 !important;
        white-space: normal !important;
    }

    .aeo-table-actions .ui-fileupload {
        width: 100% !important;
        min-width: 0;
    }

    .aeo-table-actions .ui-fileupload-buttonbar {
        width: 100% !important;
    }

    .aeo-table-actions .ui-fileupload-choose,
    .aeo-btn-view-doc,
    .aeo-btn-clear-doc {
        width: 100% !important;
        min-height: 44px !important;
        height: 44px !important;
        padding-inline: 0.7rem !important;
    }

    .aeo-table-actions .ui-fileupload-choose {
        width: 100% !important;
    }

    .aeo-doc-table .aeo-edit-column {
        width: 172px !important;
        min-width: 172px !important;
    }

    .aeo-doc-table .ui-row-editor > a {
        min-height: 42px;
        height: 42px;
        border-radius: 8px;
    }

    .aeo-doc-table .ui-row-editor .ui-row-editor-pencil {
        min-width: 96px;
    }

    .aeo-doc-table .ui-row-editor .ui-row-editor-check,
    .aeo-doc-table .ui-row-editor .ui-row-editor-close {
        min-width: 72px;
    }

    .aeo-doc-table .ui-paginator .ui-paginator-page,
    .aeo-doc-table .ui-paginator .ui-paginator-first,
    .aeo-doc-table .ui-paginator .ui-paginator-prev,
    .aeo-doc-table .ui-paginator .ui-paginator-next,
    .aeo-doc-table .ui-paginator .ui-paginator-last {
        min-width: 44px !important;
        min-height: 44px !important;
        line-height: 42px !important;
    }

    .aeo-doc-table .ui-paginator .ui-paginator-rpp-options {
        min-height: 44px !important;
    }

    .ui-dialog[id^="frmApplyForRegistration:"] {
        right: 0.5rem !important;
        left: 0.5rem !important;
        width: auto !important;
        max-width: calc(100vw - 1rem) !important;
        margin: 0 !important;
    }

    .ui-dialog[id^="frmApplyForRegistration:"] .ui-dialog-titlebar {
        min-height: 48px;
        box-sizing: border-box;
    }

    .ui-dialog[id^="frmApplyForRegistration:"] .ui-dialog-titlebar-close {
        display: flex !important;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        margin-top: -0.2rem !important;
    }

    .ui-dialog[id^="frmApplyForRegistration:"] .ui-dialog-content {
        max-height: 80vh !important;
        padding: 0.5rem !important;
    }

    .ui-dialog[id^="frmApplyForRegistration:"] .ui-galleria-panel-wrapper,
    .ui-galleria[id$=":gallery"] .ui-galleria-panel-wrapper {
        height: min(480px, 52vh) !important;
        max-height: 52vh !important;
    }
}

/* PrimeFaces reflow becomes a readable card list when enabled on narrow phones. */
@media (max-width: 560px) {
    .aeo-doc-table.ui-datatable-reflow {
        min-width: 0 !important;
        border: 0 !important;
        box-shadow: none !important;
    }

    .aeo-doc-table.ui-datatable-reflow .ui-datatable-tablewrapper,
    .aeo-doc-table.ui-datatable-reflow table,
    .aeo-doc-table.ui-datatable-reflow tbody {
        display: block;
        width: 100% !important;
        min-width: 0 !important;
        overflow: visible !important;
    }

    .aeo-doc-table.ui-datatable-reflow thead {
        display: none !important;
    }

    .aeo-doc-table.ui-datatable-reflow .ui-datatable-data tr {
        display: block;
        width: 100%;
        margin-bottom: 0.85rem;
        overflow: hidden;
        border: 1px solid var(--aeo-border-light) !important;
        border-radius: var(--aeo-radius-md);
        background: #ffffff;
        box-shadow: 0 3px 10px rgba(15, 23, 42, 0.05);
    }

    .aeo-doc-table.ui-datatable-reflow .ui-datatable-data td[role="gridcell"]:not(.ui-helper-hidden) {
        display: grid !important;
        float: none !important;
        clear: both !important;
        grid-template-columns: minmax(7.25rem, 38%) minmax(0, 1fr);
        align-items: center;
        gap: 0.7rem;
        width: 100% !important;
        min-width: 0 !important;
        padding: 0.7rem !important;
        border: 0 !important;
        border-bottom: 1px solid #eef2f7 !important;
        text-align: right !important;
    }

    .aeo-doc-table.ui-datatable-reflow .ui-datatable-data td[role="gridcell"]:last-child {
        border-bottom: 0 !important;
    }

    .aeo-doc-table.ui-datatable-reflow .ui-column-title {
        display: block !important;
        min-width: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        color: var(--aeo-text-muted);
        font-size: 0.78rem;
        font-weight: 800;
        line-height: 1.4;
        white-space: normal;
        overflow-wrap: anywhere;
    }

    .aeo-doc-table.ui-datatable-reflow tr.ui-datatable-empty-message > td {
        display: block !important;
        padding: 1.25rem !important;
        text-align: center !important;
    }

    .aeo-doc-table.ui-datatable-reflow .aeo-table-actions {
        grid-template-columns: minmax(0, 1fr) !important;
        gap: 0.5rem !important;
        justify-content: stretch !important;
    }
}

@media (max-width: 480px) {
    .aeo-reg-page {
        margin-top: 0.5rem;
        padding-inline: 0.35rem;
    }

    .aeo-hero-banner,
    .aeo-section-card,
    .aeo-action-bar {
        border-radius: 12px;
    }

    .aeo-hero-banner {
        padding: 1rem;
    }

    .aeo-hero-title {
        font-size: 1.08rem;
    }

    .aeo-card-header {
        padding-inline: 0.75rem;
    }

    .aeo-card-body {
        padding: 0.85rem 0.65rem;
    }

    .aeo-field {
        margin-bottom: 0.9rem;
    }

    .ui-dialog[id^="frmApplyForRegistration:"] .ui-galleria-panel-wrapper,
    .ui-galleria[id$=":gallery"] .ui-galleria-panel-wrapper {
        height: 48vh !important;
        max-height: 48vh !important;
    }
}
