:root {
    --app-primary: #0d6efd;
    --app-primary-dark: #0a58ca;
    --app-bg: #f5f7fb;
    --app-card-bg: #ffffff;
    --app-text: #0f172a;
    --app-muted: #64748b;
    --app-border: #e2e8f0;
    --app-danger: #dc2626;
    --app-success: #16a34a;
    --app-radius: 20px;
    --app-radius-sm: 14px;
    --app-safe-bottom: env(safe-area-inset-bottom, 0px);
    --app-safe-top: env(safe-area-inset-top, 0px);
}

* {
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

body.app-body {
    margin: 0;
    min-height: 100dvh;
    background: var(--app-bg);
    color: var(--app-text);
    font-family: 'Cairo', system-ui, -apple-system, sans-serif;
    -webkit-text-size-adjust: 100%;
    padding-top: var(--app-safe-top);
    padding-bottom: var(--app-safe-bottom);
}

.app-shell {
    max-width: 440px;
    margin: 0 auto;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    padding: 0 20px;
}

.app-topbar {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 22px 0 8px;
    position: relative;
}

.app-topbar__back {
    position: absolute;
    right: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 999px;
    background: var(--app-card-bg);
    border: 1px solid var(--app-border);
    color: var(--app-text);
    text-decoration: none;
    font-size: 1.1rem;
}

.app-topbar__logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 800;
    font-size: 1.15rem;
    color: var(--app-primary);
    text-decoration: none;
}

.app-topbar__logo span.mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: var(--app-primary);
    color: #fff;
    font-size: 1rem;
}

.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 12px 0 32px;
}

.app-card {
    background: var(--app-card-bg);
    border-radius: var(--app-radius);
    padding: 26px 22px;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.08);
}

.app-heading {
    margin: 0 0 6px;
    font-size: 1.4rem;
    font-weight: 800;
}

.app-subheading {
    margin: 0 0 22px;
    color: var(--app-muted);
    font-size: 0.94rem;
    line-height: 1.7;
}

.app-progress {
    display: flex;
    gap: 6px;
    margin-bottom: 20px;
}

.app-progress__dot {
    flex: 1;
    height: 4px;
    border-radius: 999px;
    background: var(--app-border);
    transition: background 0.2s ease;
}

.app-progress__dot.is-active,
.app-progress__dot.is-done {
    background: var(--app-primary);
}

.app-field {
    margin-bottom: 16px;
}

.app-field label {
    display: block;
    font-size: 0.86rem;
    font-weight: 700;
    color: var(--app-text);
    margin-bottom: 8px;
}

.app-input {
    width: 100%;
    font-size: 16px;
    padding: 14px 16px;
    border-radius: var(--app-radius-sm);
    border: 1.5px solid var(--app-border);
    background: #fff;
    color: var(--app-text);
    font-family: inherit;
    -webkit-appearance: none;
    appearance: none;
    transition: border-color 0.15s ease;
}

.app-input:focus {
    outline: none;
    border-color: var(--app-primary);
}

.app-input--phone {
    direction: ltr;
    text-align: center;
    letter-spacing: 1px;
    font-weight: 700;
}

.app-otp-row {
    display: flex;
    gap: 10px;
    direction: ltr;
    margin-bottom: 8px;
}

.app-otp-box {
    flex: 1 1 0;
    min-width: 0;
    width: 100%;
    max-width: 100%;
    height: 58px;
    font-size: 1.5rem;
    text-align: center;
    font-weight: 800;
    border-radius: var(--app-radius-sm);
    border: 1.5px solid var(--app-border);
    background: #fff;
    color: var(--app-text);
    -webkit-appearance: none;
    appearance: none;
}

.app-otp-box:focus {
    outline: none;
    border-color: var(--app-primary);
}

.app-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 15px 18px;
    border-radius: var(--app-radius-sm);
    border: none;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 800;
    cursor: pointer;
    text-decoration: none;
    -webkit-appearance: none;
}

.app-btn--primary {
    background: var(--app-primary);
    color: #fff;
}

.app-btn--primary:disabled {
    background: #9db8e8;
    cursor: not-allowed;
}

.app-btn--primary:not(:disabled):active {
    background: var(--app-primary-dark);
}

.app-btn--ghost {
    background: transparent;
    color: var(--app-primary);
    border: 1.5px solid var(--app-border);
}

.app-link-row {
    text-align: center;
    margin-top: 18px;
    font-size: 0.9rem;
    color: var(--app-muted);
}

.app-link-row a {
    color: var(--app-primary);
    font-weight: 800;
    text-decoration: none;
}

.app-note {
    text-align: center;
    font-size: 0.86rem;
    color: var(--app-muted);
    margin-top: 14px;
}

.app-note button {
    background: none;
    border: none;
    color: var(--app-primary);
    font-weight: 800;
    font-family: inherit;
    font-size: 0.86rem;
    padding: 0;
    cursor: pointer;
}

.app-note button:disabled {
    color: var(--app-muted);
    cursor: not-allowed;
}

.app-alert {
    display: none;
    padding: 12px 14px;
    border-radius: var(--app-radius-sm);
    font-size: 0.88rem;
    margin-bottom: 16px;
    line-height: 1.6;
}

.app-alert.is-visible {
    display: block;
}

.app-alert--danger {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.app-alert--info {
    background: #eff6ff;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

.app-alert--success {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.app-shell--wide {
    max-width: 640px;
}

.app-main--top {
    justify-content: flex-start;
    padding-top: 4px;
}

.app-step {
    display: none;
}

.app-step.is-active {
    display: block;
}

@media (max-width: 380px) {
    .app-shell {
        padding: 0 14px;
    }
    .app-card {
        padding: 22px 16px;
    }
}
