:root {
    --navy-950: #071a33;
    --navy-900: #0c2748;
    --navy-700: #16456f;
    --teal-600: #087f74;
    --teal-100: #d9f3ee;
    --amber-500: #f59e0b;
    --ink-900: #142033;
    --ink-700: #34445c;
    --ink-500: #66758a;
    --line: #d8e0ea;
    --surface: #ffffff;
    --page: #edf2f7;
    --danger: #c62828;
    --danger-soft: #fff1f1;
    --success: #087f5b;
    --success-soft: #e8f7f1;
}

* {
    box-sizing: border-box;
    letter-spacing: 0;
}

html {
    background: var(--page);
}

body {
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0;
    padding: 18px;
    display: grid;
    place-items: center;
    color: var(--ink-900);
    background: var(--page);
    font-family: 'Tajawal', Arial, sans-serif;
}

button,
input,
select {
    font: inherit;
}

a {
    color: inherit;
}

.registration-shell {
    width: min(1120px, 100%);
    min-height: 650px;
    display: grid;
    grid-template-columns: minmax(280px, 32%) minmax(0, 1fr);
    overflow: hidden;
    background: var(--surface);
    border: 1px solid #ced8e5;
    border-radius: 8px;
    box-shadow: 0 18px 48px rgba(7, 26, 51, 0.13);
}

.identity-panel {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 34px 30px 28px;
    overflow: hidden;
    color: #ffffff;
    background: var(--navy-950);
    border-left: 4px solid var(--amber-500);
}

.identity-panel::after {
    content: '';
    position: absolute;
    inset: auto 0 0;
    height: 5px;
    background: var(--teal-600);
}

.brand-lockup {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.brand-mark {
    width: 78px;
    height: 78px;
    flex: 0 0 78px;
    overflow: hidden;
    background: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.45);
    border-radius: 6px;
}

.brand-mark img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.brand-name {
    min-width: 0;
}

.brand-name strong {
    display: block;
    margin-bottom: 3px;
    font-size: 1.02rem;
    font-weight: 800;
    line-height: 1.35;
}

.brand-name span {
    display: block;
    color: #b7c9dd;
    font-size: 0.78rem;
    font-weight: 500;
    direction: ltr;
    text-align: right;
}

.identity-intro {
    margin-top: 48px;
}

.identity-kicker {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 12px;
    color: #8fd8cd;
    font-size: 0.78rem;
    font-weight: 700;
}

.identity-kicker i {
    font-size: 0.7rem;
}

.identity-intro h1 {
    margin: 0;
    font-size: clamp(1.65rem, 2.4vw, 2.2rem);
    font-weight: 800;
    line-height: 1.45;
}

.identity-intro p {
    max-width: 270px;
    margin: 12px 0 0;
    color: #b7c9dd;
    font-size: 0.9rem;
    line-height: 1.8;
}

.process-list {
    display: grid;
    gap: 14px;
    margin: 38px 0 0;
    padding: 0;
    list-style: none;
}

.process-item {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    align-items: center;
    gap: 11px;
    min-width: 0;
}

.process-icon {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    color: #ffffff;
    background: #143a61;
    border: 1px solid #31587d;
    border-radius: 50%;
    font-size: 0.78rem;
}

.process-item:first-child .process-icon {
    color: #06332f;
    background: #8fd8cd;
    border-color: #8fd8cd;
}

.process-copy strong,
.process-copy span {
    display: block;
}

.process-copy strong {
    font-size: 0.88rem;
    font-weight: 700;
}

.process-copy span {
    margin-top: 2px;
    color: #91a9c1;
    font-size: 0.73rem;
}

.identity-footer {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: auto;
    padding-top: 28px;
    color: #a8bdd2;
    font-size: 0.75rem;
    line-height: 1.5;
}

.identity-footer i {
    color: var(--amber-500);
    font-size: 1rem;
}

.form-panel {
    min-width: 0;
    padding: 30px 42px 32px;
    background: var(--surface);
}

.form-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
}

.page-heading {
    min-width: 0;
}

.page-heading span {
    display: block;
    margin-bottom: 4px;
    color: var(--teal-600);
    font-size: 0.76rem;
    font-weight: 800;
}

.page-heading h2 {
    margin: 0;
    color: var(--navy-950);
    font-size: 1.65rem;
    font-weight: 800;
    line-height: 1.35;
}

.login-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex: 0 0 auto;
    min-height: 40px;
    padding: 0 13px;
    color: var(--navy-700);
    border: 1px solid var(--line);
    border-radius: 6px;
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 700;
    transition:
        border-color 160ms ease,
        background-color 160ms ease;
}

.login-link:hover,
.login-link:focus-visible {
    background: #f4f7fa;
    border-color: #9eafc2;
    outline: none;
}

.server-alert {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr);
    align-items: center;
    gap: 11px;
    margin: 0 0 22px;
    padding: 11px 13px;
    color: #8d1f1f;
    background: var(--danger-soft);
    border: 1px solid #efb8b8;
    border-right: 4px solid var(--danger);
    border-radius: 6px;
    font-size: 0.86rem;
    font-weight: 700;
}

.server-alert i {
    font-size: 1.05rem;
    text-align: center;
}

.form-section + .form-section {
    margin-top: 23px;
    padding-top: 22px;
    border-top: 1px solid var(--line);
}

.section-heading {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 0 0 15px;
    color: var(--navy-900);
}

.section-heading i {
    width: 26px;
    height: 26px;
    display: grid;
    place-items: center;
    color: var(--teal-600);
    background: var(--teal-100);
    border-radius: 5px;
    font-size: 0.75rem;
}

.section-heading h3 {
    margin: 0;
    font-size: 0.94rem;
    font-weight: 800;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 15px 18px;
}

.field {
    min-width: 0;
}

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

.field label {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 7px;
    color: var(--ink-700);
    font-size: 0.79rem;
    font-weight: 700;
}

.required-mark {
    color: var(--danger);
}

.input-frame {
    position: relative;
    min-width: 0;
}

.input-frame > i {
    position: absolute;
    z-index: 2;
    top: 50%;
    right: 14px;
    color: #718096;
    font-size: 0.86rem;
    transform: translateY(-50%);
    pointer-events: none;
}

.input-frame input,
.input-frame select {
    width: 100%;
    height: 46px;
    min-width: 0;
    padding: 0 42px 0 13px;
    color: var(--ink-900);
    background: #fbfcfe;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    outline: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition:
        border-color 160ms ease,
        box-shadow 160ms ease,
        background-color 160ms ease;
}

.input-frame select {
    appearance: none;
    cursor: pointer;
}

.input-frame input::placeholder {
    color: #97a3b3;
    opacity: 1;
}

.input-frame input:hover,
.input-frame select:hover {
    border-color: #aab8c8;
}

.input-frame input:focus,
.input-frame select:focus {
    background: #ffffff;
    border-color: var(--teal-600);
    box-shadow: 0 0 0 3px rgba(8, 127, 116, 0.12);
}

.field.is-invalid .input-frame input,
.field.is-invalid .input-frame select {
    background: #fffafa;
    border-color: var(--danger);
    box-shadow: 0 0 0 3px rgba(198, 40, 40, 0.08);
}

.field.is-valid .input-frame input,
.field.is-valid .input-frame select {
    border-color: #52a990;
}

.ltr-input {
    direction: ltr;
    text-align: left;
}

.username-frame input {
    padding-left: 118px;
}

.username-domain {
    position: absolute;
    top: 1px;
    bottom: 1px;
    left: 1px;
    z-index: 2;
    display: flex;
    align-items: center;
    padding: 0 12px;
    color: #52657b;
    background: #eef3f7;
    border-right: 1px solid #d3dce7;
    border-radius: 5px 0 0 5px;
    font-size: 0.78rem;
    font-weight: 700;
    direction: ltr;
}

.password-frame input {
    padding-left: 45px;
}

.visibility-button {
    position: absolute;
    top: 50%;
    left: 5px;
    z-index: 3;
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    padding: 0;
    color: #5d6c7e;
    background: transparent;
    border: 0;
    border-radius: 5px;
    cursor: pointer;
    transform: translateY(-50%);
}

.visibility-button:hover,
.visibility-button:focus-visible {
    color: var(--navy-900);
    background: #eaf0f5;
    outline: none;
}

.field-help,
.validation-message {
    display: block;
    min-height: 16px;
    margin-top: 5px;
    font-size: 0.69rem;
    line-height: 1.45;
}

.field-help {
    color: var(--ink-500);
}

.validation-message {
    color: var(--danger);
    font-weight: 700;
}

.validation-message:empty {
    display: none;
}

.password-strength {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 16px;
    margin-top: 5px;
}

.strength-bars {
    width: 72px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 3px;
}

.strength-bars span {
    height: 3px;
    background: #d8e0e9;
    border-radius: 3px;
}

.password-strength[data-level='1'] .strength-bars span:nth-child(1) {
    background: var(--danger);
}

.password-strength[data-level='2'] .strength-bars span:nth-child(-n + 2) {
    background: var(--amber-500);
}

.password-strength[data-level='3'] .strength-bars span {
    background: var(--success);
}

.strength-label {
    color: var(--ink-500);
    font-size: 0.68rem;
    font-weight: 700;
}

.form-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-top: 24px;
}

.agreement-note {
    max-width: 310px;
    margin: 0;
    color: var(--ink-500);
    font-size: 0.71rem;
    line-height: 1.65;
}

.submit-button,
.success-login-button {
    min-height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 0 21px;
    color: #ffffff;
    background: var(--navy-900);
    border: 1px solid var(--navy-900);
    border-radius: 6px;
    font-size: 0.88rem;
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
    transition:
        background-color 160ms ease,
        border-color 160ms ease,
        transform 160ms ease;
}

.submit-button:hover,
.submit-button:focus-visible,
.success-login-button:hover,
.success-login-button:focus-visible {
    background: var(--teal-600);
    border-color: var(--teal-600);
    outline: none;
    transform: translateY(-1px);
}

.submit-button:disabled {
    cursor: wait;
    opacity: 0.7;
    transform: none;
}

.submit-button .loading-icon {
    display: none;
}

.submit-button.is-loading .default-icon {
    display: none;
}

.submit-button.is-loading .loading-icon {
    display: inline-block;
}

.success-state {
    min-height: 500px;
    display: grid;
    align-content: center;
    justify-items: center;
    text-align: center;
}

.success-icon {
    width: 72px;
    height: 72px;
    display: grid;
    place-items: center;
    margin-bottom: 18px;
    color: var(--success);
    background: var(--success-soft);
    border: 1px solid #a9d9c8;
    border-radius: 50%;
    font-size: 1.8rem;
}

.success-state h2 {
    margin: 0;
    color: var(--navy-950);
    font-size: 1.65rem;
    font-weight: 800;
}

.success-state > p {
    max-width: 500px;
    margin: 9px 0 22px;
    color: var(--ink-500);
    font-size: 0.88rem;
    line-height: 1.7;
}

.request-summary {
    width: min(500px, 100%);
    margin-bottom: 22px;
    border: 1px solid var(--line);
    border-right: 4px solid var(--amber-500);
    border-radius: 6px;
    text-align: right;
}

.summary-row {
    display: grid;
    grid-template-columns: 150px minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    min-height: 58px;
    padding: 10px 15px;
}

.summary-row + .summary-row {
    border-top: 1px solid var(--line);
}

.summary-row span {
    color: var(--ink-500);
    font-size: 0.76rem;
    font-weight: 700;
}

.summary-value {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 7px;
    min-width: 0;
}

.summary-value strong {
    overflow-wrap: anywhere;
    color: var(--navy-900);
    font-family: Consolas, 'Courier New', monospace;
    font-size: 0.92rem;
    direction: ltr;
}

.copy-button {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    flex: 0 0 34px;
    padding: 0;
    color: var(--navy-700);
    background: #f2f6f9;
    border: 1px solid var(--line);
    border-radius: 5px;
    cursor: pointer;
}

.copy-button:hover,
.copy-button:focus-visible {
    color: var(--teal-600);
    border-color: #8ebdb5;
    outline: none;
}

.copy-status {
    min-height: 18px;
    margin: -12px 0 10px;
    color: var(--success);
    font-size: 0.72rem;
    font-weight: 700;
}

@media (max-width: 860px) {
    body {
        padding: 12px;
        place-items: start center;
    }

    .registration-shell {
        grid-template-columns: 1fr;
        min-height: 0;
    }

    .identity-panel {
        min-height: 156px;
        padding: 22px 24px;
        border-left: 0;
        border-bottom: 4px solid var(--amber-500);
    }

    .brand-mark {
        width: 62px;
        height: 62px;
        flex-basis: 62px;
    }

    .identity-intro {
        margin-top: 18px;
    }

    .identity-intro h1 {
        font-size: 1.35rem;
    }

    .identity-intro p,
    .process-list,
    .identity-footer,
    .identity-kicker {
        display: none;
    }

    .form-panel {
        padding: 27px 28px 30px;
    }
}

@media (max-width: 620px) {
    body {
        padding: 0;
        background: #ffffff;
    }

    .registration-shell {
        width: 100%;
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }

    .identity-panel {
        min-height: 132px;
        padding: 18px 20px;
    }

    .brand-mark {
        width: 54px;
        height: 54px;
        flex-basis: 54px;
    }

    .identity-intro {
        margin-top: 13px;
    }

    .identity-intro h1 {
        font-size: 1.14rem;
    }

    .form-panel {
        padding: 23px 18px 28px;
    }

    .form-toolbar {
        align-items: flex-start;
        margin-bottom: 21px;
    }

    .page-heading h2 {
        font-size: 1.35rem;
    }

    .login-link span {
        display: none;
    }

    .login-link {
        width: 40px;
        padding: 0;
    }

    .form-grid {
        grid-template-columns: 1fr;
        gap: 13px;
    }

    .field-full {
        grid-column: auto;
    }

    .form-actions {
        align-items: stretch;
        flex-direction: column-reverse;
    }

    .agreement-note {
        max-width: none;
        text-align: center;
    }

    .submit-button,
    .success-login-button {
        width: 100%;
    }

    .success-state {
        min-height: 430px;
    }

    .summary-row {
        grid-template-columns: 1fr;
        gap: 4px;
    }

    .summary-value {
        justify-content: space-between;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition: none !important;
    }
}
