:root {
    --ink: #111827;
    --muted: #667085;
    --faint: #98a2b3;
    --border: #d9e0e8;
    --border-strong: #c8d1dc;
    --surface: #ffffff;
    --soft: #f5f7fa;
    --soft-2: #eef2f6;
    --green: #16794c;
    --green-soft: #e8f6ef;
    --black: #0b1118;
    --danger: #b42318;
    --shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 10px 30px rgba(16, 24, 40, 0.04);
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
    overflow-x: hidden;
}

body {
    margin: 0;
    background: var(--soft);
    color: var(--ink);
    font-family: "Segoe UI", Tahoma, Arial, sans-serif;
    font-size: 14px;
}

button,
input,
select {
    font: inherit;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

.signup-shell {
    min-height: 100vh;
    border-top: 4px solid var(--black);
    background:
        linear-gradient(180deg, #ffffff 0, #ffffff 72px, transparent 72px),
        var(--soft);
}

.signup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 68px;
    padding: 10px clamp(18px, 4vw, 64px);
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--ink);
    text-decoration: none;
}

.brand-mark {
    width: 38px;
    height: 38px;
    border-radius: 9px;
    border: 1px solid #e4e7ec;
    background: #fff;
    object-fit: contain;
}

.brand strong,
.brand small {
    display: block;
    letter-spacing: 0;
}

.brand strong {
    font-size: 14px;
    line-height: 1.2;
}

.brand small {
    color: var(--muted);
    font-size: 11px;
}

.signup-header-actions {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 8px;
}

.login-link,
.language-link {
    flex: 0 0 auto;
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
}

.language-link {
    border-color: transparent;
    background: #f6faf8;
    color: var(--green);
}

.signup-main {
    width: min(1580px, calc(100% - clamp(28px, 4vw, 64px)));
    margin: 0 auto;
    padding: clamp(20px, 3vw, 32px) 0 64px;
}

.progress {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 1px 1px rgba(16, 24, 40, 0.03);
}

.progress-step {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--faint);
    min-width: 0;
    white-space: nowrap;
    font-weight: 800;
}

.progress-step span {
    display: grid;
    width: 24px;
    height: 24px;
    place-items: center;
    border: 1px solid var(--border-strong);
    border-radius: 50%;
    background: var(--surface);
    font-size: 11px;
    font-weight: 700;
}

.progress-step b {
    font-size: 11px;
    font-weight: 800;
}

.progress-step.is-active,
.progress-step.is-done {
    color: var(--ink);
}

.progress-step.is-active {
    padding: 3px 6px;
    border: 1px solid #e6ebf0;
    border-radius: 999px;
    background: #f8fafc;
}

.progress-step.is-active span {
    border-color: var(--black);
    background: var(--black);
    color: white;
}

.progress-step.is-done span {
    border-color: var(--green);
    background: var(--green-soft);
    color: var(--green);
}

.progress-line {
    flex: 1 1 24px;
    height: 1px;
    margin: 0 8px;
    background: var(--border);
}

.signup-panel {
    padding: clamp(22px, 3.5vw, 34px);
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

[hidden] {
    display: none !important;
}

.panel-heading {
    margin-bottom: 22px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--border);
}

.panel-heading h1,
.success-panel h1 {
    margin: 3px 0 7px;
    font-size: clamp(22px, 3vw, 29px);
    line-height: 1.3;
    letter-spacing: 0;
    overflow-wrap: anywhere;
}

.panel-heading p,
.success-panel p,
.waiting-state p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.7;
}

.eyebrow {
    color: var(--green) !important;
    font-size: 11px !important;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: none;
}

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

.form-section-title {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 4px 0 14px;
    color: var(--ink);
    font-size: 13px;
    font-weight: 800;
}

.form-section-title::after {
    content: "";
    flex: 1 1 auto;
    height: 1px;
    background: var(--border);
}

.field {
    display: grid;
    gap: 6px;
    margin-bottom: 14px;
}

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

.field > span,
.plans-fieldset legend {
    color: #263445;
    font-size: 12px;
    font-weight: 700;
}

.field input,
.field select {
    min-width: 0;
    width: 100%;
    height: 42px;
    padding: 0 12px;
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    outline: none;
    background: white;
    color: var(--ink);
    font-size: 14px;
}

.field select {
    appearance: none;
    background-image:
        linear-gradient(45deg, transparent 50%, var(--muted) 50%),
        linear-gradient(135deg, var(--muted) 50%, transparent 50%);
    background-position:
        calc(100% - 17px) 18px,
        calc(100% - 12px) 18px;
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
    color: var(--ink);
}

.field input:focus,
.field select:focus {
    border-color: var(--green);
    box-shadow: 0 0 0 3px rgba(22, 131, 71, 0.11);
}

.phone-input-row {
    display: grid;
    grid-template-columns: minmax(176px, 0.38fr) minmax(0, 1fr);
    gap: 10px;
}

.phone-field small {
    color: var(--muted);
    font-size: 11px;
    line-height: 1.6;
}

.plans-fieldset {
    min-width: 0;
    margin: 4px 0 20px;
    padding: 0;
    border: 0;
}

.plans-fieldset legend {
    margin-bottom: 9px;
}

.plans-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(230px, 1fr));
    gap: 18px;
    align-items: stretch;
}

.plan-option {
    position: relative;
    display: block;
    min-width: 0;
    cursor: pointer;
}

.plan-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.plan-content {
    position: relative;
    display: flex;
    min-height: 500px;
    height: 100%;
    flex-direction: column;
    align-items: stretch;
    padding: 26px 26px 28px;
    border: 1px solid #d1d5db;
    border-radius: 0;
    background: white;
    transition: border-color 160ms ease, box-shadow 160ms ease;
}

.plan-content::before {
    display: none;
}

.plan-content::after {
    display: none;
}

[dir="rtl"] .plan-content {
    padding: 26px 26px 28px;
}

.plan-option input:checked + .plan-content {
    border-color: var(--green);
    background: #fff;
    box-shadow: inset 0 2px 0 var(--green), inset 0 -2px 0 var(--green);
}

.plan-head {
    display: flex;
    min-height: 104px;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    text-align: center;
}

.plan-title-row {
    display: block;
    width: 100%;
}

.plan-badge {
    position: absolute;
    top: 20px;
    left: 20px;
    padding: 6px 12px;
    border: 1px solid #b7efcf;
    border-radius: 8px;
    background: #ecfdf3;
    color: var(--green);
    font-size: 11px;
    font-weight: 800;
}

[dir="ltr"] .plan-badge {
    right: 20px;
    left: auto;
}

.plan-title {
    display: block;
    font-size: 24px;
    line-height: 1.2;
    font-weight: 800;
    overflow-wrap: anywhere;
}

.plan-price {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 8px;
    margin: 12px 0 18px;
    overflow-wrap: anywhere;
}

.plan-price strong {
    color: #12914f;
    font-family: Arial, "Cairo", system-ui, sans-serif;
    font-size: 42px;
    line-height: 1;
    font-weight: 800;
    letter-spacing: 0;
}

.plan-price small {
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.plan-description {
    display: block;
    min-height: 26px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
    line-height: 1.5;
    text-align: center;
}

.plan-message-limit {
    display: grid;
    min-height: 48px;
    place-items: center;
    margin: 0 0 20px;
    border-radius: 4px;
    background: #ecfdf3;
    color: #078a45;
    font-size: 16px;
    font-weight: 800;
}

.plan-features {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 11px;
}

.plan-features span {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #1f2a44;
    font-size: 14px;
    font-weight: 800;
    line-height: 1.45;
    text-align: right;
}

[dir="ltr"] .plan-features span {
    text-align: left;
}

.plan-features i {
    display: grid;
    flex: 0 0 auto;
    width: 21px;
    height: 21px;
    place-items: center;
    border: 1px solid var(--border);
    border-radius: 4px;
    color: #0d944f;
    font-style: normal;
    font-size: 14px;
    line-height: 1;
}

.primary-button,
.secondary-button,
.text-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    max-width: 100%;
    min-height: 38px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 700;
    text-decoration: none;
    font-size: 13px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.primary-button {
    width: 100%;
    padding: 8px 16px;
    border: 1px solid var(--black);
    background: var(--black);
    color: white;
}

.primary-button:disabled {
    cursor: not-allowed;
    border-color: #d0d5dd;
    background: #eaecf0;
    color: #98a2b3;
}

.step-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: flex-end;
    width: 100%;
    margin-top: 18px;
}

.step-actions .primary-button,
.step-actions .secondary-button {
    width: auto;
    min-width: 132px;
    min-height: 42px;
    padding: 8px 18px;
    border-radius: 8px;
}

.button-icon {
    display: inline-grid;
    width: 16px;
    height: 16px;
    place-items: center;
    font-family: Arial, system-ui, sans-serif;
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
}

.icon-action-button .sr-only {
    position: static;
    width: auto;
    height: auto;
    padding: 0;
    margin: 0;
    overflow: visible;
    clip: auto;
    white-space: nowrap;
}

.secondary-button {
    padding: 7px 13px;
    border: 1px solid var(--border-strong);
    background: white;
    color: var(--ink);
    font-size: 12px;
    white-space: nowrap;
}

.text-button {
    width: 100%;
    margin-top: 12px;
    border: 0;
    background: transparent;
    color: var(--muted);
    font-size: 12px;
}

.form-error {
    margin: 0 0 14px;
    padding: 10px 12px;
    border: 1px solid #fecdca;
    border-radius: 8px;
    background: #fef3f2;
    color: var(--danger);
    font-size: 13px;
    line-height: 1.6;
}

.verification-target,
.code-block {
    display: grid;
    gap: 5px;
    margin-bottom: 12px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: #fbfcfd;
}

.verification-target span,
.code-block span {
    color: var(--muted);
    font-size: 12px;
}

.verification-target strong,
.code-block strong {
    overflow-wrap: anywhere;
    font-size: 24px;
    letter-spacing: 0;
    min-width: 0;
    font-weight: 800;
}

.code-block {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
}

.code-block span {
    grid-column: 1 / -1;
}

.whatsapp-button {
    margin-top: 6px;
    border-color: var(--green);
    background: var(--green);
}

.email-code-form {
    display: grid;
    gap: 14px;
}

.waiting-state {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 18px;
    padding: 15px 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.waiting-state strong {
    font-size: 13px;
}

.spinner {
    display: inline-block;
    flex: 0 0 auto;
    width: 20px;
    height: 20px;
    border: 2px solid #d7dce1;
    border-top-color: var(--green);
    border-radius: 50%;
    animation: spin 800ms linear infinite;
}

.loading-row {
    display: flex;
    grid-column: 1 / -1;
    align-items: center;
    gap: 10px;
    min-height: 80px;
    color: var(--muted);
    font-size: 13px;
}

.verified-mark {
    display: grid;
    width: 44px;
    height: 44px;
    margin: 0 auto 12px;
    place-items: center;
    border-radius: 50%;
    background: var(--green-soft);
    color: var(--green);
    font-size: 25px;
    font-weight: 800;
}

.panel-heading-centered,
.success-panel {
    text-align: center;
}

.show-password {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 18px;
    color: var(--muted);
    cursor: pointer;
    font-size: 12px;
}

.show-password input {
    width: 16px;
    height: 16px;
    accent-color: var(--green);
}

.success-panel .spinner {
    margin-top: 20px;
}

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

@media (max-width: 1100px) {
    .plans-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {
    .signup-header {
        min-height: 60px;
        padding-right: 12px;
        padding-left: 12px;
    }

    .signup-main {
        width: min(100% - 20px, 1580px);
        padding-top: 12px;
        padding-bottom: 58px;
    }

    .progress {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(62px, 1fr));
        gap: 0;
        width: 100%;
        padding: 4px 6px;
        margin-bottom: 8px;
    }

    .progress-line {
        display: none;
    }

    .progress-step {
        position: relative;
        justify-content: center;
        gap: 3px;
        min-height: 30px;
        padding: 2px;
        border-radius: 7px;
    }

    .progress-step:not(:last-child)::after {
        content: "";
        position: absolute;
        left: -2px;
        top: 50%;
        width: 3px;
        height: 3px;
        border-radius: 50%;
        background: var(--border-strong);
        transform: translateY(-50%);
    }

    .progress-step.is-active {
        background: var(--black);
        color: #fff;
    }

    .progress-step.is-active span {
        border: 0;
        background: transparent;
        color: inherit;
    }

    .progress-step span {
        width: auto;
        height: auto;
        border: 0;
        border-radius: 0;
        background: transparent;
        color: inherit;
        font-size: 10px;
        font-weight: 800;
    }

    .progress-step b {
        display: block;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        font-size: 9px;
    }

    .form-grid,
    .plans-grid {
        grid-template-columns: 1fr;
    }

    .plan-content,
    [dir="rtl"] .plan-content {
        min-height: 0;
        height: auto;
        padding: 14px;
    }

    .plan-head {
        min-height: 0;
    }

    .plan-title {
        font-size: 18px;
    }

    .plan-description {
        min-height: 0;
        font-size: 12px;
    }

    .plan-price {
        margin: 10px 0;
    }

    .plan-price strong {
        font-size: 30px;
    }

    .plan-message-limit {
        min-height: 42px;
        margin-bottom: 14px;
        font-size: 14px;
    }

    .plan-features {
        gap: 10px;
    }

    .plan-features span {
        font-size: 12px;
    }

    .plan-features i {
        width: 20px;
        height: 20px;
        font-size: 13px;
    }

    .step-actions {
        position: fixed;
        left: 8px;
        bottom: 8px;
        z-index: 50;
        direction: ltr;
        gap: 5px;
        align-items: center;
        justify-content: flex-start;
        width: auto;
        margin-top: 0;
        padding: 3px;
        border: 1px solid rgba(217, 224, 232, 0.72);
        border-radius: 999px;
        background: rgba(255, 255, 255, 0.78);
        box-shadow: 0 5px 14px rgba(16, 24, 40, 0.12);
        backdrop-filter: blur(6px);
        opacity: 0.82;
        transition: opacity 160ms ease, transform 160ms ease;
    }

    .step-actions:hover,
    .step-actions:focus-within {
        opacity: 1;
    }

    .step-actions .primary-button,
    .step-actions .secondary-button {
        width: 32px;
        min-width: 0;
        height: 32px;
        min-height: 32px;
        padding: 0;
        border-radius: 50%;
    }

    .step-actions .primary-button {
        order: 1;
    }

    .step-actions .secondary-button {
        order: 2;
    }

    .icon-action-button .sr-only {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }

    .phone-input-row {
        grid-template-columns: 1fr;
    }

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

    .panel-heading h1,
    .success-panel h1 {
        font-size: 21px;
    }

    .verification-target strong,
    .code-block strong {
        font-size: 21px;
    }
}

@media (max-width: 480px) {
    .brand {
        gap: 8px;
    }

    .brand-mark {
        width: 34px;
        height: 34px;
    }

    .brand small {
        display: none;
    }

    .signup-header-actions {
        gap: 6px;
    }

    .login-link,
    .language-link {
        font-size: 13px;
    }

    .signup-panel {
        padding: 16px 14px;
        border-radius: 9px;
    }

    .panel-heading {
        margin-bottom: 16px;
        padding-bottom: 14px;
    }

    .field input {
        height: 42px;
    }

    .plan-content {
        min-height: 0;
    }

    .code-block {
        grid-template-columns: 1fr;
    }

    .secondary-button {
        width: 100%;
    }

    .waiting-state {
        align-items: flex-start;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}
